home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / BB14.ZIP / BB.DOC next >
Text File  |  1993-06-18  |  170KB  |  5,875 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.           BasicBasic is copyright (c) 1992, 1993 by Mark Davidsaver.
  8.           All rights reserved.
  9.  
  10.  
  11.           LICENSE INFORMATION
  12.           -------------------------------------------------------
  13.  
  14.       This shareware version of BasicBasic may be distributed
  15.       to others subject to the following 2 conditions:
  16.  
  17.         1) Only a nominal fee, not to exceed $5.00, may be
  18.            charged for distribution.
  19.  
  20.         2) The following files must ALL be distributed UNALTERED.
  21.  
  22.          DOS Version             Windows Version
  23.          -----------             ---------------
  24.          BBE.EXE                 WBBE.EXE
  25.          BB.EXE                  WBB.EXE
  26.          BBLIB14.EXE             WBBLIB14.EXE
  27.          BBR.DAT                 BBR.DAT
  28.          BB14.STB                BB14.STB
  29.          BB.DOC                  BB.DOC
  30.          ORDER.DOC               ORDER.DOC
  31.          SAMPLE1.EXE             SAMPLE1.BAS
  32.          SAMPLE2.EXE             SAMPLE2.BAS
  33.          SAMPLE3.EXE             SAMPLE3.BAS
  34.          SAMPLE4.EXE             SAMPLE4.BAS
  35.          SAMPLE5.EXE             SAMPLE5.BAS
  36.          SAMPLE6.EXE             SAMPLE6.BAS
  37.          SAMPLE7.EXE             SAMPLE7.BAS
  38.          SAMPLE8.EXE             SAMPLE8.BAS
  39.          SAMPLE9.EXE             SAMPLE9.BAS
  40.          SAMPLE10.EXE            SAMPLE10.BAS
  41.          SAMPLE11.EXE            SAMPLE11.BAS
  42.          SAMPLE12.EXE            SAMPLE12.BAS
  43.          SAMPLE13.EXE            SAMPLE13.BAS
  44.                      SAMPLEW1.BAS
  45.                      SAMPLEW2.BAS
  46.                      SAMPLEW3.BAS
  47.                      SAMPLEW4.BAS
  48.                      SAMPLEW3.ICO
  49.                      BBICON.EXE
  50.                      WBB.FON
  51.  
  52.           The software and accompanying documentation are provided
  53.           "as is" without warranty of any kind.  The entire risk as
  54.           to the results and performance of the software is assumed
  55.           by you.
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.                                TABLE OF CONTENTS
  76.  
  77.  
  78.                 Summary ................................  2
  79.  
  80.                 Getting Started Quickly ................  3
  81.  
  82.                 DOS Instructions ..... .................  5
  83.  
  84.                 Windows Instructions ..... .............  9
  85.  
  86.                 Statement and Function Reference ....... 13
  87.  
  88.                 Graphics Programming for Beginners ..... 47
  89.  
  90.                 Programming Buttons .................... 50
  91.  
  92.                 Programming Menus ...................... 52
  93.  
  94.                 Programming Dialog Boxes ............... 54
  95.  
  96.                 Program Icon ........................... 60
  97.  
  98.                 Communications Programming ............. 62
  99.  
  100.                 Windows and Graphics ................... 63
  101.  
  102.                 Bitmaps ................................ 67
  103.  
  104.                 Windows and Fonts ...................... 71
  105.  
  106.                 Chaining and Common .................... 75
  107.  
  108.                 BasicBasic Technical ................... 76
  109.  
  110.                 Windows Metacommands ................... 78
  111.  
  112.                 Metacommands ........................... 79
  113.  
  114.                 Seperate Compilation ................... 80
  115.  
  116.                 Default Windows Font.................... 82
  117.                  (386 Enhanced Mode Font information)
  118.  
  119.                 Errors ................................. 84
  120.  
  121.                 Keyboard codes ......................... 86
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                        1
  128.  
  129.  
  130.  
  131.  
  132.  
  133.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.           SUMMARY
  141.           -------------------------------------------------------
  142.  
  143.           BasicBasic is an easy to use program development system
  144.           for DOS or Windows.  You can use BasicBasic to make your
  145.           own programs.  BasicBasic creates EXE files which can be
  146.           run under DOS or Windows.  BasicBasic supports both
  147.           graphics and text screens.  BasicBasic supports many
  148.           commands common to other Basic compilers, as well as, many
  149.           new commands unique to BasicBasic.
  150.  
  151.           Programs written using BasicBasic can run under either DOS
  152.           or Windows.  The BasicBasic development system, itself,
  153.           may run under either DOS or Windows.
  154.  
  155.           Here is a list of statements and functions the BasicBasic
  156.           compiler recognizes.  Refer to the detailed description
  157.           later on for the exact syntax recognized.
  158.  
  159.           ABS   ADDSUBMENU   ASC   ATN   BEEP   BITMAPC   BITMAPH
  160.           CALL   CBUTTON   CHAIN   CHDIR   CHDRIVE   CHR$   CIRCLE
  161.           CLOSE   CLS   COLOR   COMMAND$   COMMON   COMSTATI
  162.           COPYBITS   COS   CREATEBITMAP   CREATEFONT   CSRLIN
  163.           CURDIR$   DATA  DATE$   DBUTTON  DECLARE   DIALOG
  164.           DIALOG$   DIM   DIR$   DLEN   DO   END SUB   EOF   EXIT DO
  165.            EXIT FUNCTION   EXIT SUB   FIELD   FIX   FONT   FONT$
  166.           FOR..NEXT   FREEMEM   FUNCTION   GET   GET #
  167.           GOSUB..RETURN   GOTO   IF..THEN..ELSE   INKEY$   INPUT
  168.           INPUT #   INPUT$   INSTR  INT   KILL   LEFT$   LEN   LET
  169.           LINE   LINE INPUT #   LOADBITMAP   LOC  LOCATE   LOOP
  170.           LSET   MAINMENU   MENUITEMGRAY   MENUITEMON   MID$   MKDIR
  171.            MOUSEB   MOUSEON   MOUSEX   MOUSEY   ONCLOSE   ONPAINT
  172.           OPEN   OPEN "COMn:"   OPENFILEREAD   OPENFILESAVE   PAINT
  173.           PALETTE   POINT   POS   POSITION   POINT   PRINT #
  174.           LPRINT   PRINT USING  PUT   PUT #   LPRINT USING   PRESET
  175.           PSET    OSTYPE   RADIOON   RADIOOFF   RANDOMIZE   READ
  176.           REM   RESTORE   RETURN   RIGHT$   RMDIR   RND   SCREEN
  177.           SCROLLAREA   SELECTBITMAP   SELECTFONT   SETERRLEVEL
  178.           SHELL   SIN   SOUND   SPACE$   STOP   STOREBITMAP   STR$
  179.           STRING$   SUB   SYSTEM   TAB   TAN   TIME$   TIMER
  180.           UCASE$   VAL   WRITE #
  181.  
  182.           and the operators     +  -  /  *  \  ^  AND  OR
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.                                        2
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.           GETTING STARTED QUICKLY
  207.           -------------------------------------------------------
  208.  
  209.           The easiest way to run BasicBasic is to have all required
  210.           files in one directory.  Create a directory and copy the
  211.           supplied files into the directory.  BasicBasic files
  212.           required for each operating environment are:
  213.  
  214.                      FILE        USE
  215.                      _____       __________________________________
  216.  
  217.                     BBE.EXE   \
  218.                      BB.EXE   |- required under DOS
  219.                    BB14.STB   |
  220.                 BBLIB14.EXE   |
  221.                     BBR.DAT   /
  222.  
  223.  
  224.                    WBBE.EXE   \
  225.                     WBB.EXE   |- required under Windows
  226.                    BB14.STB   |
  227.                WBBLIB14.EXE   |
  228.                  BBICON.EXE   |
  229.                     WBB.FON   |
  230.                     BBR.DAT   /
  231.  
  232.           In addition many sample programs are provided to let you
  233.           get started quickly.  The sample programs have file names
  234.           of the format SAMPLEnn.BAS.  In addition an Icon (.ICO)
  235.           and Bitmap (.BMP) file are provided for use by the sample
  236.           programs.  The best way to install BasisBasic is to copy
  237.           ALL supplied files to your BasicBasic directory.
  238.  
  239.           If you are new to programming, or new to BasicBasic, it is
  240.           a good idea to start out by compiling and running these
  241.           sample programs.  If you are new to Basic programming a
  242.           good second step is to try modifying the sample programs
  243.           to operate differently.
  244.  
  245.             SAMPLE1.BAS
  246.             SAMPLE2.BAS\__ Examples applicable to DOS and Windows
  247.             SAMPLE3.BAS/
  248.                 .
  249.                 .
  250.  
  251.             SAMPLEW1.BAS
  252.             SAMPLEW2.BAS __ Examples For Windows Only
  253.                 .
  254.                 .
  255.  
  256.  
  257.  
  258.           DOS Startup:
  259.                                        3
  260.  
  261.  
  262.  
  263.  
  264.  
  265.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.             To start the BasicBasic development system under DOS you
  273.             must first be in the directory you placed the BasicBasic
  274.             files in; then type 'BBE' at the DOS prompt.
  275.  
  276.  
  277.           WINDOWS Startup:
  278.  
  279.             To start the BasicBasic developement system under
  280.             Windows you must run the program WBBE.  You can do this
  281.             from the Program Manager File menu.  Alternately you can
  282.             install WBBE in a program group using the Program
  283.             Manager and then start it by double clicking on it's
  284.             icon.
  285.  
  286.           Once started you are in the BasicBasic edit mode and can
  287.           type in programs from the keyboard or read them in from
  288.           disk.  When ready you can tell BasicBasic to run the
  289.           program.  The program will run and then control will be
  290.           returned to the BasicBasic editor.  The following sections
  291.           provide a more detailed description of how to operate in
  292.           the BasicBasic development system.
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.                                        4
  326.  
  327.  
  328.  
  329.  
  330.  
  331.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  332.  
  333.  
  334.  
  335.  
  336.  
  337.           DOS INSTRUCTIONS
  338.           -------------------------------------------------------
  339.  
  340.           BasicBasic allows you to write programs using the BASIC
  341.           programming language.  This programming language works the
  342.           same in DOS or Windows.  The BasicBasic editor which
  343.           allows you to enter your program is slightly different in
  344.           DOS and Windows.  This section contains specific
  345.           instructions on using the DOS version of BasicBasic.  The
  346.           next section contains similar instructions for Windows.
  347.  
  348.           (Note: If you do not want to use the BasicBasic editor,
  349.           you do not have to.  See the section on Seperate
  350.           Compilation for instructions on compiling programs entered
  351.           with another editor)
  352.  
  353.           This section assumes you have installed all required files
  354.           in one directory as described in the preceding section
  355.           'Getting Started Quickly'.  It also assumes that you have
  356.           Changed Directories so that the BasicBasic directory is
  357.           the current directory.
  358.  
  359.           To start BasicBasic you type  BBE<
  360.  
  361.                                                  (< means Enter)
  362.  
  363.           BasicBasic will then setup the screen in the following
  364.           format:
  365.  
  366.                  ---------------------------------------------
  367.             1   |                 file name line              |
  368.             2   |               Function summary line         |
  369.             3   |                                             |
  370.             .   .                                             .
  371.             .   .                                             .
  372.             .   .                                             .
  373.             25  |                   Error line                |
  374.                  ---------------------------------------------
  375.  
  376.           The top line (line 1) displays the name of the currently
  377.           opened file.  When you first start BasicBasic no file will
  378.           be opened so the top line displays the name of the
  379.           program.  The second line contains a list of the most
  380.           commonly used funtion keys.  The bottom line (line 25)
  381.           displays any errors which occur during compilation.  Lines
  382.           3 through 24 are used for display/editing of your program.
  383.  
  384.           The DOS version of BasicBasic does not use a mouse for
  385.           editing functions (though, if you have a mouse, you can
  386.           use it in the programs you write).  All editor operations
  387.           are available with a combination of keyboard keys.
  388.  
  389.           The best way to learn to use any editor is to use it.  The
  390.           BasicBasic editor is fairly straight-forward.  F1 will
  391.                                        5
  392.  
  393.  
  394.  
  395.  
  396.  
  397.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  398.  
  399.  
  400.  
  401.  
  402.  
  403.           bring up a list of all special key combinations.  F3 opens
  404.           a file for editing or compiling.  F8 compiles a program.
  405.           F9 runs a program (and compiles, if necessary).  These are
  406.           the most common special keys you will use.
  407.           
  408.           At this point open and compile or run some of the supplied
  409.           sample programs (e.g. SAMPLE1.BAS).  F3-OPEN will ask you
  410.           to enter the name of the program you want to open.  You
  411.           can either type in the file name, including the extension,
  412.           or use the TAB key to select a file from the file list
  413.           box.  You use the up and down arrow keys to scroll through
  414.           the file list box.  Remember that if you type in the file
  415.           name you MUST supply the complete name, including
  416.           extension (e.g. SAMPLE1.BAS).
  417.  
  418.           Here is a description of the editor special keys:
  419.  
  420.             Insert            Toggles between Overtype/Insert modes
  421.           
  422.             F1 Help           Displays a list of editor special keys
  423.  
  424.             F2 New            Closes any currently open file and
  425.                               clears the screen.  You will be
  426.                               prompted to save any changes.
  427.  
  428.             F3 Open           Displays a box to allow you to open a
  429.                               file.  You may either type in the
  430.                               complete file name or TAB to a file
  431.                               list box and select file with the
  432.                               arrow keys.  After highlighting the
  433.                               file you want press ENTER.
  434.  
  435.             F4 SaveAs         Allows you to save the text you are
  436.                               editing and specify a file name.
  437.  
  438.             Ctrl-F4 Save      Saves the text you are editing to the
  439.                               same name you originally opened.
  440.  
  441.             F5 Exit           Exits the program.  You will be
  442.                               prompted to save any changes.
  443.  
  444.             F6 Find           Displays a box to allow you to enter
  445.                               text to find.  Upper/lower case are
  446.                               ignored.  The search is from the
  447.                               current position in the file.  To
  448.                               search the entire file you must have
  449.                               the start of the file displayed on the
  450.                               screen.  The found string will be
  451.                               highlighted and the display altered to
  452.                               show the highlighted item on the first
  453.                               display line.  If no match is found a
  454.                               'BEEP' will be sounded.
  455.  
  456.             Ctrl-F6 Find Next Searches for the next occurence of the
  457.                                        6
  458.  
  459.  
  460.  
  461.  
  462.  
  463.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  464.  
  465.  
  466.  
  467.  
  468.  
  469.                               last search string you entered.
  470.  
  471.             F7 Next Error     If you have compiled a program and
  472.                               there were errors in the compilation,
  473.                               then the bottom line of the display
  474.                               will display the error message. If
  475.                               there is more than one error pressing
  476.                               F7 will go to the next error message.
  477.                               When an error message is displayed,
  478.                               the corresponding source line will be
  479.                               moved to the first display position if
  480.                               applicable.
  481.  
  482.             F8 Compile        Compiles your current source and makes
  483.                               an EXE file if there are no errors.
  484.  
  485.             F9 Compile & Run  Compiles your current source(only if
  486.                               required) and then executes the
  487.                               program.  When your program terminates
  488.                               you will return to the editor.
  489.                               
  490.             F10 About         Tells about BasicBasic.
  491.  
  492.             Up arrow
  493.             Down arrow
  494.             Left arrow
  495.             Right arrow       Moves cursor around the screen.
  496.  
  497.             Insert            Changes between insert mode(small
  498.                               cursor) and overwrite move (large
  499.                               cursor)
  500.  
  501.             Delete            Deletes current character
  502.  
  503.             Ctrl-PgUp         Goes to first line of file.
  504.  
  505.             Ctrl-PgDn         Goes to last line of file.
  506.  
  507.             Shift-arrow key   Holding down the shift key while
  508.                               pressing an arrow key will select text
  509.                               for copying or cutting.
  510.  
  511.             Shift-Delete      Copies currently selected text to
  512.                               clipboard.
  513.  
  514.             Ctrl-F1           If text is selected deletes all of
  515.                               selected text and transfers to
  516.                               clipboard.
  517.  
  518.             Shift-insert      Pastes from clipboard to screen.
  519.  
  520.             Home              Moves to beginning of line.
  521.  
  522.             End               Moves past last character in line.
  523.                                        7
  524.  
  525.  
  526.  
  527.  
  528.  
  529.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.           RUNTIME ERRORS
  539.  
  540.             While executing a program you have entered you may
  541.           receive a runtime error message.  The message will have
  542.           two numbers; the first being an error number and the
  543.           second being a runtime error address.  This manual
  544.           contains a list of error numbers.  The runtime error
  545.           address will show you what line had the error.
  546.  
  547.             Each time you compile your program BasicBasic creates a
  548.           file which shows the runtime address for each line.  You
  549.           can examine this file with the BasicBasic editor to find
  550.           which line contains the address the address at which the
  551.           runtime error occurs.  The file BasicBasic creates has the
  552.           extension .TMP.  For example if you compile the program
  553.           SAMPLE1.BAS, then BasicBasic will create the file
  554.           SAMPLE1.TMP, which will have the runtime addresses.
  555.  
  556.           (Occasionaly you might want to delete all .TMP files from
  557.           your BasicBasic directory to conserve disk space.)
  558.           
  559.  
  560.           TOO BIG
  561.  
  562.           If you write very large programs there may not be room in
  563.           memory to compile your program while the editor is
  564.           running.  If you receive an error message saying not
  565.           enough memory to compile you may need to exit the editor
  566.           and compile seperately.  See the section on Seperate
  567.           Compilation for instructions.
  568.  
  569.           IMPORTANT:  To run programs compiled with BasicBasic the
  570.           runtime module must be present.  For DOS this is the file
  571.           BBLIB14.EXE.
  572.  
  573.  
  574.  
  575.  
  576.  
  577.  
  578.  
  579.  
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.                                        8
  590.  
  591.  
  592.  
  593.  
  594.  
  595.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.           WINDOWS INSTRUCTIONS
  603.           -------------------------------------------------------
  604.  
  605.           BasicBasic allows you to write programs using the BASIC
  606.           programming language.  This programming language works the
  607.           same in DOS or Windows.  The BasicBasic editor which
  608.           allows you to enter your program is slightly different in
  609.           DOS and Windows.  This section contains specific
  610.           instructions on using the Windows version of BasicBasic.
  611.           The preceding section contains similar instructions for
  612.           DOS.
  613.  
  614.           (Note: If you do not want to use the BasicBasic editor,
  615.           you do not have to.  See the section on Seperate
  616.           Compilation for instructions on compiling programs entered
  617.           with another editor)
  618.  
  619.  
  620.           You may install the BasicBasic program in a program group.
  621.           The file you want to install is WBBE.EXE.  Alternately you
  622.           can select RUN from the program manager and execute
  623.           WBBE.EXE.
  624.  
  625.           Once started you will see a standard Windows editing
  626.           screen.  There is a menu bar at the top with available
  627.           choices.  To compile and run a program (such as
  628.           SAMPLE1.BAS) you would need to select OPEN from the file
  629.           menu and then COMPILE & RUN from the Build menu.  Remember
  630.           that you must enter the complete file name, including
  631.           extension (e.g. SAMPLE1.BAS).
  632.  
  633.           The best way to learn any editor is to use it.  The
  634.           BasicBasic editor is fairly straight-forward.  The  FILE
  635.           menu contains an Open command.  The MAKE menu contains
  636.           commands to compile and run your program.
  637.  
  638.           Here is a complete list of the Windows BasicBasic editor
  639.           functions.:
  640.  
  641.  
  642.             Insert Key         Toggles between Overtype/Insert modes
  643.  
  644.  
  645.           FILE MENU
  646.  
  647.             New               Closes any currently open file and
  648.                               clears the screen.  You will be
  649.                               prompted to save any changes.
  650.  
  651.             Open              Displays a box to allow you to open a
  652.                               file.  You may either type in the
  653.                               complete file name or TAB to a file
  654.                               list box and select file with the
  655.                                        9
  656.  
  657.  
  658.  
  659.  
  660.  
  661.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  662.  
  663.  
  664.  
  665.  
  666.  
  667.                               arrow keys.  After highlighting the
  668.                               file you want press ENTER.
  669.  
  670.             SaveAs            Allows you to save the text you are
  671.                               editing and specify a file name.
  672.  
  673.             Save              Saves the text you are editing to the
  674.                               same name you originally opened.
  675.  
  676.             Exit              Exits the program.  You will be
  677.                               prompted to save any changes.
  678.  
  679.  
  680.           EDIT MENU
  681.  
  682.             The edit menu allows you to manipulate text you have
  683.             selected.  You select text in the usual Windows fashion
  684.             by holding down the mouse button as you move over the
  685.             text you want to select.  Alternately you can use the
  686.             arrow keys with the SHIFT key held down.
  687.  
  688.  
  689.             Copy              Copies currently selected text to
  690.                               clipboard.
  691.  
  692.             Cut               If text is selected deletes all of
  693.                               selected text and transfers to
  694.                               clipboard.
  695.  
  696.             Paste      Pastes from clipboard to screen.
  697.                               
  698.  
  699.           SEARCH MENU
  700.  
  701.             Find              Displays a box to allow you to enter
  702.                               text to find.  Upper/lower case are
  703.                               ignored.  The search is from the
  704.                               current position in the file.  To
  705.                               search the entire file you must have
  706.                               the start of the file displayed on the
  707.                               screen.  The found string will be
  708.                               highlighted and the display altered to
  709.                               show the highlighted item on the first
  710.                               display line.  If no match is found a
  711.                               'BEEP' will be sounded.
  712.  
  713.             Find Next         Searches for the next occurence of the
  714.                               last search string you entered.
  715.  
  716.  
  717.           MAKE MENU
  718.  
  719.             Compile           Compiles your current source and makes
  720.                               an EXE file if there are no errors.
  721.                                       10
  722.  
  723.  
  724.  
  725.  
  726.  
  727.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  728.  
  729.  
  730.  
  731.  
  732.  
  733.                               Control is returned to BasicBasic when
  734.                               the compilation is complete.
  735.  
  736.             Compile & Run     Compiles your current source(only if
  737.                               required) and then executes the
  738.                               program.  If there are compilation
  739.                               errors the program will not be
  740.                               executed.  When your compiled program
  741.                               is run it's window will be made the
  742.                               top window, but the BasicBasic editor
  743.                               will continue to run.
  744.  
  745.           OPTIONS MENU
  746.  
  747.              In there are errors in compilation BasicBasic will
  748.              display an error windows at the bottom of the edit
  749.              windows.  You can scroll through this window to examine
  750.              errors.  Selecting an error in the error window will
  751.              cause the corresponding source line to become the first
  752.              line in the edit window.  The Options Menu contains an
  753.              item, 'Error Window' which will remove the error window
  754.              when you no longer need the errors displayed.
  755.  
  756.  
  757.           TRANSFER MENU
  758.  
  759.              The transfer menu contains one entry.  This is the
  760.              'Icon Editor'.  Using the $ICON metacommand you can
  761.              assign a Windows Icon to your program.  The icon editor
  762.              allows you to create the icon.  See the section on
  763.              'Program Icon' for more information.
  764.  
  765.  
  766.           RUNTIME ERRORS
  767.  
  768.             While executing a program you have entered you may
  769.           receive a runtime error message.  The message will have
  770.           two numbers; the first being an error number and the
  771.           second being a runtime error address.  This manual
  772.           contains a list of error numbers.  The runtime error
  773.           address will show you what line had the error.
  774.  
  775.             Each time you compile your program BasicBasic creates a
  776.           file which shows the runtime address for each line.  You
  777.           can examine this file with the BasicBasic editor to find
  778.           which line contains the address the address at which the
  779.           runtime error occurs.  The file BasicBasic creates has the
  780.           extension .TMP.  For example if you compile the program
  781.           SAMPLE1.BAS, then BasicBasic will create the file
  782.           SAMPLE1.TMP, which will have the runtime addresses.
  783.  
  784.           (Occasionaly you might want to delete all .TMP files from
  785.           your BasicBasic directory to conserve disk space.)
  786.           
  787.                                       11
  788.  
  789.  
  790.  
  791.  
  792.  
  793.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.           TOO BIG
  801.  
  802.           If you write very large programs there may not be room in
  803.           memory to compile your program while the editor is
  804.           running.  If you receive an error message saying not
  805.           enough memory to compile you may need to exit the editor
  806.           and compile seperately.  See the section of Seperate
  807.           Compilation for instructions.
  808.  
  809.           IMPORTANT:  To run programs compiled with BasicBasic the
  810.           runtime module must be present.  For Windows this is the
  811.           file WBBLIB14.EXE.
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.                                       12
  854.  
  855.  
  856.  
  857.  
  858.  
  859.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.           STATEMENT AND FUNCTION REFERENCE
  867.           -------------------------------------------------------
  868.  
  869.           Here is a brief description of available functions and
  870.           statements.  More detailed information on those not unique
  871.           to BasicBasic can be found in standard Basic reference
  872.           books.
  873.  
  874.  
  875.  
  876.           ABS(numericexpression)
  877.  
  878.             This function returns the absolute value of the numeric
  879.             expression.
  880.  
  881.  
  882.  
  883.           ADDSUBMENU  menunumber,stringexpression,keycode
  884.  
  885.             Addsubmenu adds an item to a pull down menu with the
  886.             text stringexpression.  When the user selects this menu
  887.             item the keycode will be returned at the next INKEY$
  888.             function call.  See the section 'Programming Menus' for
  889.             more details
  890.  
  891.  
  892.  
  893.           ASC(string expression)
  894.  
  895.             This function returns a numerical value which is the
  896.             ASCII code for the first character of string expression.
  897.  
  898.  
  899.  
  900.           ATN(numeric expression)
  901.  
  902.             This function returns the arctangent of a numeric
  903.             expression.
  904.  
  905.  
  906.  
  907.           BEEP
  908.  
  909.             This statement sounds the ASCII bell character.
  910.  
  911.  
  912.  
  913.           BITMAPC(filename,longinteger array)
  914.  
  915.             This function returns colors values for a disk file
  916.             device independent bitmap.
  917.  
  918.             e.g.     A=BITMAPC("C:\WINDOWS\CARS.BMP",COLORS&(0))
  919.                                       13
  920.  
  921.  
  922.  
  923.  
  924.  
  925.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  926.  
  927.  
  928.  
  929.  
  930.  
  931.  
  932.             Each element of the array COLORS& will contain one RGB
  933.             color value up to the total colors available (see
  934.             BITMAPH).  See the section BITMAPS for further
  935.             information.
  936.  
  937.  
  938.  
  939.           BITMAPH(filename,longinteger array)
  940.  
  941.  
  942.             This function returns the bitmap header from a file
  943.             device independent bitmap.
  944.  
  945.             e.g.   A=BITMAPC("C:\WINDOWS\CARS.BMP",HEADER&(0))
  946.  
  947.             The data returned are:
  948.  
  949.                 0 - size of bitmapinfoheader
  950.                 1 - width in pixels
  951.                 2 - height in pixels
  952.                 3 - always 1
  953.                 4 - color bits per pixel
  954.                 5 - compression flag
  955.                 6 - total bytes in image
  956.  
  957.             See the section BITMAPS for further information.
  958.  
  959.  
  960.  
  961.           CALL name [arguments]
  962.  
  963.             This statement transfers control to a BASIC SUB
  964.             procedure.  Arguments may be any valid BasicBasic data
  965.             type.  Arrays are specified with emply parenthesis.
  966.  
  967.             here is an example of a CALL statement.
  968.  
  969.                    a=2
  970.                    b=3
  971.                    call printsum(a,b)
  972.                    stop
  973.  
  974.                sub sum(x,y)
  975.                    print x+y
  976.                end sub
  977.  
  978.             The EXIT FUNCTION statement may be used to exit a
  979.             function at any time.  You may not transfer control out
  980.             of the function except with the END FUNCTION or EXIT
  981.             FUNCTION statements.
  982.  
  983.             In this version of BasicBasic procedures do not have
  984.             access to common variables.
  985.                                       14
  986.  
  987.  
  988.  
  989.  
  990.  
  991.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.           CBUTTON "name",keycode,0,"type",0,left,top,xsize,ysize,
  1003.                   forecolor,backcolor
  1004.  
  1005.             This command defines and creates a button on screen.
  1006.             This command is DOS and Windows compatible.  In screen
  1007.             mode 0 left,top,xsize,ysize are in character units.  In
  1008.             graphics screen modes these must be supplied in pixel
  1009.             units.  The name is the text which will be displayed in
  1010.             the button.  When you define a button you must define
  1011.             the keycode which will be returned when that button is
  1012.             pressed by the user.  Legal button types are "Radio",
  1013.             "Push" or "Invisible".  Left, top, xsize, ysize define
  1014.             the position and size of the button(in character
  1015.             position).  Radio buttons may have a foreground and
  1016.             background color defined.  If these are left 0 then the
  1017.             default colors will be used.  In DOS the colors are also
  1018.             used for Pushbuttons.
  1019.  
  1020.             When the user presses the button the indicated keycode
  1021.             will be returned to the INKEY$ function.  If a button is
  1022.             pressed while executing the INPUT command the input will
  1023.             be ended, but the keycode will not be returned until a
  1024.             subsequent INKEY$ function is called.  Instead of using
  1025.             the mouse to press the indicated button, the user can
  1026.             also press the keyboard key which returns the indicated
  1027.             keycode.
  1028.  
  1029.             Any key may be defined for a button.  See the section
  1030.             "Keyboard codes" for a list of codes recognized by
  1031.             BasicBasic.  As an example the uppercase letter 'A'
  1032.             would be the keycode 65.  Extended keycodes are
  1033.             indicated by adding 1000 to the second part of the code.
  1034.             For example F1 would be 1059, or F10 would be 1068.
  1035.  
  1036.               e.g. CBUTTON "Exit",1068,"Push",0,1,1,8,1,7,4
  1037.  
  1038.                    Creates a push button on the top line.  Because
  1039.                    it is a Push button the color values are ignored
  1040.                    in windows, but used in DOS.
  1041.  
  1042.             See RADIOON and RADIOOFF for instructions on
  1043.             checking/unchecking radio buttons.
  1044.  
  1045.             See the section "Programming Buttons" for more detail on
  1046.             programming buttons.
  1047.  
  1048.             Note that while CBUTTON creates a button it will not
  1049.             respond to the mouse button until the function MOUSEON
  1050.             has been issued.
  1051.                                       15
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.             SAMPLE5.BAS and SAMPLE6.BAS use the CBUTTON command.
  1065.  
  1066.  
  1067.  
  1068.           CHAIN  filespec
  1069.  
  1070.             This command transfers control from the current program
  1071.             to another program.  COMMON may be used to pass
  1072.             variables between programs.  Files are left open when
  1073.             transfering to another program.  See the section
  1074.             'Chaining and Common' for more details.
  1075.  
  1076.                 e.g.  CHAIN "TEST2.EXE"
  1077.  
  1078.  
  1079.  
  1080.           CHDIR drive$
  1081.  
  1082.             This statement changes the default directory for the
  1083.             specified drive.  CHDIR statement changes the default
  1084.             directory, but not the default drive.
  1085.  
  1086.  
  1087.  
  1088.           CHDRIVE drive$
  1089.  
  1090.             This statement changes the current drive to that given
  1091.             in the string expression drive$
  1092.  
  1093.  
  1094.  
  1095.           CHR$(numeric expression)
  1096.  
  1097.             This function returns the ASCII code for the numeric
  1098.             expression.  The returned code is one character.
  1099.  
  1100.  
  1101.  
  1102.           CIRCLE [STEP](x1,y),radius,[color],[start],[end],[aspect]
  1103.  
  1104.             This statement draws a circle, ellipse, or pie section
  1105.             on the graphics screen.  (x,y) are the screen
  1106.             coordinates of the center of the figure.  Radius is the
  1107.             radius in pixels.  Start and End are angles in radians.
  1108.             Omiting these results in a complete circle or ellipse.
  1109.             You may use Start,End to draw arcs or pie sections.  A
  1110.             complete circle has a start randian of 0 and an end
  1111.             radian of 6.2832.
  1112.  
  1113.             If start or end are negative the value is converted to a
  1114.             positive number for purposes of drawing the arc, but
  1115.             then a line is drawn from the center of the figure to
  1116.             the end point of the arc.  PIE figures may be draw in
  1117.                                       16
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1124.  
  1125.  
  1126.  
  1127.  
  1128.  
  1129.             this way.
  1130.  
  1131.               Example of a complete circle, radius 50, color blue
  1132.  
  1133.                       SCREEN 8
  1134.                       CIRCLE (100,100),50,1
  1135.  
  1136.               Example of pie figure, filled in
  1137.  
  1138.                       SCREEN 8
  1139.                       CIRCLE (100,100),50,1,-.01,-2
  1140.                       PAINT (102,98),1,1
  1141.  
  1142.             Aspect can be used to adjust the ratio of y radius to
  1143.             the x radius.  By default BasicBasic sets aspect to a
  1144.             number to create round circles for the type of screen
  1145.             being used.
  1146.  
  1147.  
  1148.  
  1149.           CLOSE #filenumber
  1150.  
  1151.             This statement terminates I/O to the indicated
  1152.             filenumber.  Only one number allowed for each CLOSE
  1153.             command.
  1154.  
  1155.  
  1156.  
  1157.           CLS
  1158.  
  1159.             This statement clears the screen.  If a scrollable area
  1160.             has been define the entire screen is still cleared.
  1161.  
  1162.  
  1163.  
  1164.           COLOR foreground,background
  1165.  
  1166.             The format of this statement varies depending on the
  1167.             screen mode you are in.
  1168.  
  1169.             MODE 0
  1170.  
  1171.               This statement sets the screen colors to the indicated
  1172.               foreground and background colors.  Color values are:
  1173.  
  1174.                0 - Black
  1175.                1 - Blue
  1176.                2 - Green
  1177.                3 - Cyan
  1178.                4 - Red
  1179.                5 - Magenta
  1180.                6 - Brown
  1181.                7 - White
  1182.                8 - Gray
  1183.                                       17
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.                9 - Light Blue
  1196.               10 - LIght Green
  1197.               11 - Light Cyan
  1198.               12 - Light Red
  1199.               13 - Light Magenta
  1200.               14 - Yellow
  1201.               15 - High intensity white
  1202.  
  1203.             Foreground values can be 0 through 15 and background
  1204.             values can be 0 through 15.
  1205.  
  1206.           MODE 8,9
  1207.  
  1208.             The first argument (foreground color) is a color
  1209.             attribute.  The second argument(background color) is a
  1210.             screen color.  For Windows programs see the section
  1211.             WINDOWS AND GRAPHICS for additional information on the
  1212.             COLOR statement.
  1213.  
  1214.           MODE 12
  1215.  
  1216.             Only one argument is used.  The first argument
  1217.             (foreground) color is a color attribute.  In this mode
  1218.             to change the background color for the entire screen use
  1219.             the PALETTE command to change the definition of color
  1220.             attribute 0.
  1221.  
  1222.           MODE 1000
  1223.  
  1224.             This mode is only supported under Windows.  The first
  1225.             argument (foreground) is a color attribute.  The second
  1226.             arguement (background) is a color attribute.  In this
  1227.             mode to change a palette color you must use the PALETTE
  1228.             command.
  1229.  
  1230.  
  1231.  
  1232.           COMMAND$
  1233.  
  1234.             This function returns the command line used to start the
  1235.             program.
  1236.  
  1237.               e.g.  TEST myfile.dat
  1238.  
  1239.               COMMAND$ would return:  myfile.dat
  1240.  
  1241.  
  1242.  
  1243.           COMMON  variablelist
  1244.  
  1245.             Common passes variables to a chained program.
  1246.             Variablelist is a list of variables and arrays whose
  1247.             contents will be preserved when Chaining to a new
  1248.             program.  Only 'blank' common is supported.  A blockname
  1249.                                       18
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.             is not allowed.  the SHARED attribute is not allowed.
  1262.             Arrays are indicated by blank parenthesis.  See the
  1263.             section 'Chaining and Common' for more details.
  1264.  
  1265.               e.g.  COMMON A,B,A$,B$()
  1266.  
  1267.  
  1268.  
  1269.           COMSTATI(comnum)
  1270.  
  1271.             This function returns the status of a communications
  1272.             port.  8 bits of data are returned.  These are defined
  1273.             as follows:
  1274.  
  1275.               bit 7 = Data Carrier Detect
  1276.                   6 = Ring Indicator
  1277.                   5 - Data Set Ready
  1278.                   4 - Clear to Sent
  1279.                   3 - Break Detect
  1280.                   2 - Framing Error
  1281.                   1 - Parity Error
  1282.                   0 - Overrun Error
  1283.  
  1284.               e.g.  a=COMSTATI(1)
  1285.  
  1286.  
  1287.  
  1288.           COPYBITS sbm,sx,sy,xlen,ylen,dbm,dx,dy,0
  1289.  
  1290.             This command is ignored under DOS.  This command copies
  1291.             the contents of one bitmap to another.  The parameter
  1292.             sbm is the source bitmap number and may be either 0, 1,
  1293.             or 2, where 0 is the screen and 1 and 2 are memory
  1294.             bitmaps previously created with the CREATEBITMAP
  1295.             command.  Similarly dbm is the destination bitmap
  1296.             number.  Sx, sy are the coordinates of the upper left
  1297.             corner of the source bitmap to be transfered.  Xlen, and
  1298.             ylen are the number of pixels to copy.  Dx, dy are the
  1299.             coordinates of the upper left corner of the destination.
  1300.  
  1301.             The following example copies a 100 by 100 pixel
  1302.             rectangle starting at 0,0 to a memory bitmap and then
  1303.             copies it back to the screen at x=200 and y=0.
  1304.  
  1305.                  sx=0
  1306.                  sy=0
  1307.                  dx=0
  1308.                  dy=0
  1309.                  copybits 0,sx,sy,100,100,1,dx,dy,0
  1310.                  dx=200
  1311.                  dy=0
  1312.                  copybits 1,sx,sy,100,100,0,dx,dy,0
  1313.  
  1314.  
  1315.                                       19
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.           COS(n)
  1330.  
  1331.             This function returns the cosine of an angle expressed
  1332.             in radians.
  1333.  
  1334.  
  1335.  
  1336.           CREATEBITMAP n,0,xsize,ysize
  1337.  
  1338.             This command is ignored under DOS.  Under Windows it
  1339.             creates a memory bitmap of the given size.  The first
  1340.             argument, n, may be either 1 or 2.  The second argument
  1341.             must always be a 0.  You can create a maximum of 2
  1342.             memory bitmaps.  Using the SELECTBITMAP command you can
  1343.             tell BasicBasic to route all screen output to a bitmap
  1344.             instead.  Then you can use the COPYBIT command to
  1345.             quickly place a complex graphic on the screen.
  1346.  
  1347.             If a SCREEN command is used in the program always use
  1348.             CREATEBITMAP after the SCREEN command!
  1349.  
  1350.             Here is an example of a createbitmap command:
  1351.  
  1352.                  pxsize=100
  1353.                  pysize=50
  1354.                  CREATEBITMAP 1,0,pxsize,pysize
  1355.  
  1356.             SAMPLEW4.BAS uses the CREATEBITMAP command.
  1357.  
  1358.  
  1359.  
  1360.           CREATE FONT
  1361.  
  1362.             Allows creation of fonts in Windows.  See section
  1363.             WINDOWS AND FONTS for a description of this command.
  1364.  
  1365.             SAMPLEW1.BAS, SAMPLEW2.BAS and SAMPLEW3.BAS use the
  1366.             CREATE FONT command.
  1367.  
  1368.  
  1369.  
  1370.           CSRLIN
  1371.  
  1372.             This function gets the current line position of the
  1373.             cursor(starting with 1).  In graphics mode 1000 the
  1374.             pixel line position is returned (starting with 0).
  1375.  
  1376.  
  1377.  
  1378.           CURDIR$[(drive$)]
  1379.  
  1380.             This function returns the path currently is use for the
  1381.                                       20
  1382.  
  1383.  
  1384.  
  1385.  
  1386.  
  1387.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1388.  
  1389.  
  1390.  
  1391.  
  1392.  
  1393.             specified drive.  If the optional parameter is omitted
  1394.             then the path for the currently selected drive is
  1395.             returned.
  1396.  
  1397.  
  1398.  
  1399.           DATA
  1400.  
  1401.             This statement is used in conjuction with the READ
  1402.             statement to input numeric or string constants.
  1403.  
  1404.  
  1405.  
  1406.           DATE$
  1407.  
  1408.             This function returns a string of ten characters
  1409.             corresponding to the current computer date.
  1410.  
  1411.  
  1412.  
  1413.           DBUTTON keycode
  1414.  
  1415.             This statement erases a button from the screen (using
  1416.             currently define colors) and disables input from it.
  1417.             The keycode should be the same as that used in the
  1418.             CBUTTON command.  See the section "Programming Buttons"
  1419.             for more information on buttons.
  1420.  
  1421.  
  1422.  
  1423.           DECLARE function name[(parameters)]
  1424.  
  1425.             The DECLARE statement defines a function before the
  1426.             actual function is created.  Before you can use a user
  1427.             function in your program you must either create the
  1428.             function (using the FUNCTION, END FUNCTION statements)
  1429.             or declare it with the DECLARE statement.  The DECLARE
  1430.             statement, therefore, allows you to put your user
  1431.             functions someplace else other than the start of our
  1432.             program.  The name of the function, type and number of
  1433.             parameters must the the same in the DECLARE statement as
  1434.             in the FUNCTION statement.
  1435.  
  1436.                         DECLARE ADD%(A%,B%0
  1437.  
  1438.                         I%=2
  1439.                         J%=3
  1440.                         PRINT ADD%(I%,J%)
  1441.                         STOP
  1442.  
  1443.                     FUNCTION ADD%(X%,Y%)
  1444.                        ADD%=X%+Y%
  1445.                     END FUNCTION
  1446.  
  1447.                                       21
  1448.  
  1449.  
  1450.  
  1451.  
  1452.  
  1453.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1454.  
  1455.  
  1456.  
  1457.  
  1458.  
  1459.  
  1460.  
  1461.           DIALOG A$(),x,y,xlen,ylen,id,Header String
  1462.  
  1463.             This statement executes a Dialog.  See the section
  1464.             "Programming Dialog Boxes" for details.  The array a$()
  1465.             contains text which defines the dialog box.  X, y, xlen,
  1466.             ylen are in pixel units in graphics screen modes and
  1467.             character units in screen mode 0.
  1468.  
  1469.  
  1470.  
  1471.           DIALOG$()
  1472.  
  1473.             This function returns information on a Dialog Control.
  1474.             See the section "Programming Dialog Boxes" for details.
  1475.  
  1476.             SAMPLE11.BAS uses the DIALOG$ command.
  1477.  
  1478.  
  1479.  
  1480.           DIM variable(subscripts),...
  1481.  
  1482.             Defines arrays.  There is no default array size of 10 in
  1483.             BasicBasic; every array must be defined.  SHARED is not
  1484.             supported.  Arrays may not be used as subscripts in a
  1485.             Dimension statement.
  1486.  
  1487.                 LEGAL Dimension
  1488.  
  1489.                    DIM A$(10,5)
  1490.                    DIM B%(A%)
  1491.  
  1492.                 ILLEGAL Dimension
  1493.  
  1494.                    DIM A$(B%(1,2),5)
  1495.  
  1496.  
  1497.  
  1498.  
  1499.           DIR$(path,[type])
  1500.               or
  1501.           DIR$
  1502.  
  1503.             This function returns file names.  If no type is
  1504.             specified or type is set to 0 then file names not
  1505.             including system and hidden will be returned.  If no
  1506.             path is specified then the next name using the previous
  1507.             search path will be returned.  Type may be set to a
  1508.             non-zero value to return the names of special classes of
  1509.             files.
  1510.  
  1511.                       type       file type
  1512.                        1         Read Only files
  1513.                                       22
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.                        2         Hidden files
  1526.                        3         System files
  1527.                        5         Directories
  1528.                        6         Archive bit set
  1529.  
  1530.           SAMPLE10.BAS uses the DIR$ command.
  1531.  
  1532.  
  1533.  
  1534.           DLEN (string)
  1535.  
  1536.             This function returns the length in pixels of a string.
  1537.             It is intended for use in Windows graphics mode but also
  1538.             works in DOS graphics mode.
  1539.  
  1540.  
  1541.  
  1542.           DO [UNTIL condition][UNTIL condition]
  1543.  
  1544.             This statement incombination with the LOOP statement
  1545.             repeats a series of statements while/until the condition
  1546.             is true.  A LOOP command must terminate the series of
  1547.             statements.  Alternately the while/until condition may
  1548.             be placed after the LOOP command.  In this case the
  1549.             true/false checking of the condition occurs AFTER the
  1550.             series of statements has been executed once.  Here are
  1551.             some examples:
  1552.  
  1553.  
  1554.                  I=0
  1555.                  DO WHILE I<5
  1556.                    PRINT I
  1557.                    I=I+1
  1558.                  LOOP
  1559.  
  1560.                  I=0
  1561.                  DO UNTIL I>4
  1562.                    PRINT I
  1563.                    I=I+1
  1564.                  LOOP
  1565.  
  1566.                  I=0
  1567.                  DO
  1568.                    PRINT I
  1569.                    I=I+1
  1570.                  LOOP WHILE I<6
  1571.  
  1572.                  I=0
  1573.                  DO
  1574.                    PRINT I
  1575.                    I=I+1
  1576.                  LOOP UNTIL I>3
  1577.  
  1578.             The EXIT DO statement may be used to exit from a
  1579.                                       23
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.             DO..LOOP series of statements.  Here is an example:
  1592.  
  1593.                  I=0
  1594.                  DO WHILE I<20000
  1595.                    IF INKEY$<>"" THEN EXIT DO
  1596.                    PRINT I
  1597.                    I=I+1
  1598.                  LOOP
  1599.  
  1600.  
  1601.  
  1602.           END SUB
  1603.  
  1604.             This statement is used at the end of a SUB procedure.
  1605.             See the CALL statement for an example.
  1606.  
  1607.  
  1608.  
  1609.           EOF(filenumber)
  1610.  
  1611.             This function tests for end-of-file.
  1612.  
  1613.  
  1614.  
  1615.           EXIT DO
  1616.  
  1617.             Statement allows exit of a DO..LOOP series.  See the
  1618.             description of the DO statement for an explanation.
  1619.  
  1620.  
  1621.  
  1622.           EXIT FUNCTION
  1623.  
  1624.             Statement allows exit of a user Function.  See the
  1625.             description of the FUNCTION statement for more details.
  1626.  
  1627.  
  1628.  
  1629.           EXIT SUB
  1630.  
  1631.             Statement allows exit of a user Procedure.  See the
  1632.             description of the SUB statement for more details.
  1633.  
  1634.  
  1635.  
  1636.           FIELD #filenumber,fieldwidth AS stringvariable...
  1637.  
  1638.             This statement allocates space for variables in
  1639.             random-access file buffer.  The filenumber is the number
  1640.             under which the file was opened.  Fieldwidth is a number
  1641.             indicating the length of the field and string variable
  1642.             is the name of the field.  Multiple fields can be
  1643.             defined at once.
  1644.  
  1645.                                       24
  1646.  
  1647.  
  1648.  
  1649.  
  1650.  
  1651.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.                e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  1658.                      FIELD #1,18 AS NAME$,18 AS ADDRESS$
  1659.                      LSET NAME$="FRED SMITH"
  1660.                      LSET ADDRESS$="1 MAIN STREET"
  1661.                      PUT #1,1
  1662.                      CLOSE #1
  1663.  
  1664.  
  1665.  
  1666.           FIX(numeric expression)
  1667.  
  1668.             This function returns the integer representation of the
  1669.             value in numeric expression.  -n.x returns n-1 if x>0.
  1670.  
  1671.  
  1672.  
  1673.           FONT(n)
  1674.  
  1675.             This function returns information about a Windows font.
  1676.             See the section WINDOWS AND FONTS for a complete
  1677.             description of this function
  1678.  
  1679.  
  1680.  
  1681.           FONT$(n)
  1682.  
  1683.             This function returns information about a Windows font.
  1684.             See the section WINDOWS AND FONTS for a complete
  1685.             description of this function.
  1686.  
  1687.  
  1688.  
  1689.           FOR..NEXT
  1690.  
  1691.           FOR counter=start TO end [STEP increment]
  1692.  
  1693.             Defines a program loop.
  1694.  
  1695.                 FOR I%=1 TO 100
  1696.                   PRINT I%
  1697.                 NEXT I%
  1698.  
  1699.  
  1700.  
  1701.           FREEMEM
  1702.  
  1703.             This function returns the amount of global memory
  1704.             available to other programs.
  1705.  
  1706.  
  1707.  
  1708.           FUNCTION name,[(Paramenter list)]
  1709.  
  1710.             This statement starts a user defined function.  User
  1711.                                       25
  1712.  
  1713.  
  1714.  
  1715.  
  1716.  
  1717.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.             defined functions can perform a series of instructions
  1724.             and then return a single value of type String, Float,
  1725.             Integer, or Long Integer.  A user defined function is
  1726.             used in an expression in the same way that a BasicBasic
  1727.             function is used.  Functions must be defined before they
  1728.             can be used. Typically all functions are defined at the
  1729.             start of a program.  They are not executed until called
  1730.             in an expression.
  1731.  
  1732.             name: The name of the function.  The name defines what
  1733.             type of value is returned from the function.  This name
  1734.             is assigned a value somewhere in the the function.
  1735.  
  1736.             parameter list: The list of variables that will be
  1737.             passed to the User Function.  Any changes to the
  1738.             parameters are not returned to the calling expression.
  1739.  
  1740.             Here is an example of a function which makes all
  1741.             characters in a string upper case.
  1742.  
  1743.                FUNCTION UPPER$(A$)
  1744.                  FOR I%=1 TO LEN(A$)
  1745.                   A%=ASC(MID$(A$,I%,1))
  1746.                   IF A%>=96 AND A%<=96+26 THEN
  1747.                     A%=A%-32
  1748.                     MID$(A$,I%,1)=CHR$(A%)
  1749.                   END IF
  1750.                  NEXT I%
  1751.                  UPPER$=A$
  1752.                END FUNCTION
  1753.  
  1754.                PRINT UPPER$("This will display in upper case.")
  1755.  
  1756.  
  1757.           The EXIT FUNCTION statement may be used to exit a function
  1758.           at any time.  You may not transfer control out of the
  1759.           function except with the END FUNCTION or EXIT FUNCTION
  1760.           statements.
  1761.  
  1762.           In this version of BasicBasic functions do not have access
  1763.           to common variables.
  1764.             
  1765.  
  1766.  
  1767.           GET (x1,y1)-(x2,y2),arrayname
  1768.  
  1769.             This statement gets a range of pixels from the graphics
  1770.             screen and puts them into an array.  The may be placed
  1771.             back on the screen using the PUT statement.  In
  1772.             BasicBasic only one set of pixels may be stored in each
  1773.             array and storing begins with the first element of the
  1774.             array.
  1775.  
  1776.                       e.g.
  1777.                                       26
  1778.  
  1779.  
  1780.  
  1781.  
  1782.  
  1783.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1784.  
  1785.  
  1786.  
  1787.  
  1788.  
  1789.                          DIM A%(100)
  1790.  
  1791.                          GET (100,100)-(109,109),A%
  1792.  
  1793.             It is important that you dimension the array large
  1794.             enough to hold the pixel data.
  1795.  
  1796.             You can calculate the space required as follows:
  1797.  
  1798.                size=int(((totalpixels*bits/pixel)+1)/8)+100
  1799.  
  1800.             Where size is in bytes.  Each element of an integer
  1801.             array takes up 2 bytes.
  1802.  
  1803.  
  1804.  
  1805.           GET #filenumber,recordnumber,variable$
  1806.  
  1807.             This statement allows input of data from RANDOM or
  1808.             BINARY files.
  1809.  
  1810.             For random files the record format and input/output
  1811.             buffer must previously have been assigned with a FIELD
  1812.             statement.  The following example would read in the
  1813.             first record of an existing random file which is defined
  1814.             to have a record length of 512 bytes, of which the first
  1815.             32 bytes are the first name and the second 32 bytes are
  1816.             the last name.  After the GET statement in the example
  1817.             is executed the data will be in the input buffer
  1818.             variables FIRST$ and LAST$.  After the file is closed
  1819.             the input buffer is cleared so data must be retrieved
  1820.             from the input buffer variables before closing the file.
  1821.  
  1822.                  OPEN "test.dat" FOR RANDOM AS #1 LEN = 512
  1823.                  FIELD #1,32 AS FIRST$,32 AS LAST$
  1824.                  TOPREC = 1
  1825.                  GET #1, TOPREC
  1826.                  IF EOF(1) THEN
  1827.                     PRINT "NO DATA IN FILE"
  1828.                  ELSE
  1829.                     SAVEFIRST$=FIRST$
  1830.                     SAVELAST$=LAST$
  1831.                  END IF
  1832.                  CLOSE #1
  1833.  
  1834.  
  1835.  
  1836.             For binary files recordnumber is an absolute byte
  1837.             position in the file.  Data will be input to variable$.
  1838.             Variable$ must be set up before an INPUT to be the same
  1839.             size as the desired number of characters to read.  The
  1840.             first byte of the file is number 1.
  1841.  
  1842.                OPEN "test.dat" FOR BINARY AS #1
  1843.                                       27
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.                FIRSTBYTE=1
  1856.                FIRST$=SPACE$(32)
  1857.                LAST$=SPACE$(32)
  1858.                GET #1, FIRSTBYTE,FIRST$
  1859.                FIRSTBYTE=FIRSTBYTE+32
  1860.                GET #1, FIRSTBYTE,LAST$
  1861.                CLOSE #1
  1862.  
  1863.  
  1864.  
  1865.           GOSUB label
  1866.  
  1867.             This statement causes a branch to a subroutine.
  1868.  
  1869.  
  1870.           GOTO label
  1871.  
  1872.             This statement causes a jump to another program
  1873.             location.
  1874.  
  1875.  
  1876.  
  1877.           IF...THEN...ELSE
  1878.  
  1879.             Permits conditional execution depending on evaluation of
  1880.             expression.
  1881.  
  1882.  
  1883.  
  1884.           INKEY$
  1885.  
  1886.             This function returns a character from the keyboard.
  1887.  
  1888.  
  1889.  
  1890.           INPUT[;]["promptstring"{;|,}] variablelist
  1891.  
  1892.             Executing this statement causes the program to pause and
  1893.             wait for input.  A promptstring may optionally be
  1894.             printed before pausing for input.  If a comma is used
  1895.             after the promptstring or if no prompt string is
  1896.             specified a question mark is displayed before waiting
  1897.             for input.  If INPUT is followed by a semicolon, then no
  1898.             carriage return line feed is performed after the Enter
  1899.             key is pressed.
  1900.  
  1901.  
  1902.  
  1903.           INPUT #filenumber,variablelist
  1904.  
  1905.             This statement reads items from an open file to the
  1906.             given variables.  When inputting data leading spaces
  1907.             will be ignored.
  1908.  
  1909.                                       28
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.           INPUT$(n,port)
  1924.  
  1925.             This function returns a string of n characters from a
  1926.             communications port.  If n characters are not available
  1927.             the function will WAIT for that many characters to
  1928.             arrive.  To avoid 'hanging up' your program use the LOC
  1929.             function to find how many characters are waiting.  If a
  1930.             communications error occurs the number of characters
  1931.             returned may be less than what you requested.  In this
  1932.             case use the function COMSTATI to determine what error
  1933.             occured.  See the section "Communications Programming"
  1934.             for more details.
  1935.  
  1936.  
  1937.  
  1938.           INSTR([start],expressiontosearch,searchforexpression)
  1939.  
  1940.             This function searches for the first occurence of
  1941.             searchforexpression in expressiontosearch and returns
  1942.             the position at which the match is found.  If no match
  1943.             is found then 0 is returned.
  1944.  
  1945.  
  1946.  
  1947.           INT(numericexpression)
  1948.  
  1949.             This function returns the largest integer less than or
  1950.             equal to numericexpression.
  1951.  
  1952.  
  1953.  
  1954.           KILL stringexpression
  1955.  
  1956.             This command deletes the file whose name is in
  1957.             stringexpression.
  1958.  
  1959.  
  1960.  
  1961.           LEFT$(stringexpression,n)
  1962.  
  1963.             This function returns a string of length n from the left
  1964.             part of stringexpression
  1965.  
  1966.  
  1967.  
  1968.           LEN(stringexpression)
  1969.  
  1970.             This function returns the number of characters in
  1971.             stringexpression.
  1972.  
  1973.  
  1974.  
  1975.                                       29
  1976.  
  1977.  
  1978.  
  1979.  
  1980.  
  1981.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.           LET
  1988.  
  1989.             May optionally be used before assignment statements.
  1990.             e.g. LET I=3
  1991.  
  1992.  
  1993.  
  1994.           LINE [STEP](x1,y1)-[STEP](x2,y2),[color],[B],[BF]
  1995.  
  1996.             This command draws a line, box, or filled box on the
  1997.             graphics screen.  The (x1,y1), (x2,y2) arguments are the
  1998.             end points of the line.  If a color is not specified the
  1999.             current foreground color will be used.  The 'B' option
  2000.             draws a box.  BF draws the box and paints the interior.
  2001.  
  2002.  
  2003.  
  2004.           LINE INPUT #,filenumber,stringvariable
  2005.  
  2006.             This statement inputs an entire line from a file.  Input
  2007.             continues until the next carriage return.
  2008.  
  2009.  
  2010.  
  2011.           LOADBITMAP filename,0,dx,dy,sx,sy,xsize,ysize,cv,xm,ym
  2012.  
  2013.             This statement loads and displays a bitmap.  The bitmap
  2014.             is displayed with the upper left screen coordinates at
  2015.             dx,dy.  sx,sy are the upper left bitmap coordinates.
  2016.             Xsize, ysize are the length in pixels of each dimension.
  2017.             If cv is set to 0 then all colors in the bitmap are
  2018.             converted to the closest defined color for the display.
  2019.             If set to 1 no conversion takes place.  Xm is an
  2020.             optional scaling factor in the x direction.  A positive
  2021.             number is used as a multiplier for the number of x bits;
  2022.             a negative number is used as a divider.  Xy is an
  2023.             optional scaling factor in the y direction.  A positive
  2024.             number is used as a multiplier and a negative number is
  2025.             used as a divider.
  2026.  
  2027.             See the section BITMAPS for further information.
  2028.  
  2029.  
  2030.  
  2031.           LOC(filenumber)
  2032.  
  2033.             This function returns the current absolute byte position
  2034.             within a file.  For a communications port it returns the
  2035.             number of received characters waiting in the receive
  2036.             buffer.
  2037.  
  2038.  
  2039.  
  2040.           LOCATE row,column,[cursor]
  2041.                                       30
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2048.  
  2049.  
  2050.  
  2051.  
  2052.  
  2053.  
  2054.             Positions the cursor on the screen.  If cursor is set to
  2055.             0 then the cursor is turned off.  In graphics mode 1000
  2056.             row, column are pixel positions (starting with 0) rather
  2057.             than character positions (starting with 1).
  2058.  
  2059.  
  2060.           
  2061.           LOOP [WHILE condition][UNTIL condition]
  2062.  
  2063.             Statement terminates a DO..LOOP series.  See the
  2064.             description of the DO statement for an explanation.
  2065.  
  2066.  
  2067.  
  2068.           LPRINT expressionlist [,|;]
  2069.  
  2070.             Prints the items in expression list.  See PRINT for a
  2071.             more complete description.
  2072.  
  2073.  
  2074.  
  2075.           LPRINT USING formatstring; expressionlist[,|;]
  2076.  
  2077.             The formatstring tells how to print the items in
  2078.             expressionlist.  See PRINT USING for a description of
  2079.             format string items.
  2080.  
  2081.  
  2082.  
  2083.           LSET stringvariable=string expression
  2084.  
  2085.             This command puts data into a random access file buffer.
  2086.             The buffer must be previously defined by a FIELD
  2087.             statement.  The data is left justified in the field.
  2088.  
  2089.               e.g.  OPEN "TEST.DAT" FOR RANDOM AS #1
  2090.                     FIELD #1,18 AS NAME$,18 AS ADDRESS$
  2091.                     LSET NAME$="FRED SMITH"
  2092.                     LSET ADDRESS$="1 MAIN STRING"
  2093.                     PUT #1,4
  2094.                     CLOSE #1
  2095.  
  2096.  
  2097.  
  2098.           MAINMENU string1,string2...,string6,[bc,fc,gc,mc]
  2099.  
  2100.             This command defines the main menu bar.  Up to six menu
  2101.             names may be specified.  If less than six are defined,
  2102.             blank strings must be present.  See the section
  2103.             'Programming menus' for more detail.
  2104.  
  2105.             Under DOS, the optional numeric values bc,fc,gc,mc
  2106.             represent background color, foreground color, graycolor,
  2107.                                       31
  2108.  
  2109.  
  2110.  
  2111.  
  2112.  
  2113.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2114.  
  2115.  
  2116.  
  2117.  
  2118.  
  2119.             and the character code of the key which calls the menu
  2120.             bar respectively.  Under DOS if you use menus there are
  2121.             only 24 text lines remaining for use(lines 1-24).
  2122.  
  2123.               e.g. MAINMENU "File","Color","Options","","",""
  2124.  
  2125.                    MAINMENU "File","Color","","","","",7,1,4,1067
  2126.                      Defines a menu bar which under DOS would have a
  2127.                      background color of 7 and foreground color of 1
  2128.                      and which could be summoned by pressing F9.
  2129.  
  2130.             SAMPLE4.BAS uses the MAINMENU command.
  2131.  
  2132.  
  2133.  
  2134.           MENUITEMGRAY keycode
  2135.  
  2136.             DOS.  This command 'grays' a submenu item.  While gray
  2137.             the item cannot be selected by the user.  See the
  2138.             section 'Programming menus' for more detail.
  2139.  
  2140.  
  2141.  
  2142.           MENUITEMON keycode
  2143.  
  2144.             This command enables a submenu item.  When enable a user
  2145.             may select this menu item.
  2146.  
  2147.  
  2148.  
  2149.           MID$(stringexpression,n,length)
  2150.  
  2151.             This function returns a string composed of length
  2152.             characters starting with character n in
  2153.             stringexpression.
  2154.  
  2155.  
  2156.  
  2157.           MKDIR stringexpression
  2158.  
  2159.             This command creates a directory specified by
  2160.             stringexpression
  2161.  
  2162.  
  2163.  
  2164.           MOUSEB
  2165.  
  2166.             This function returns information on whether mouse
  2167.             buttons are pressed.  Bit 0 is 1 if left button is
  2168.             pressed.  Bit 1 is 1 if right button is pressed.  Bit 2
  2169.             is 1 if middle button is pressed.
  2170.  
  2171.               e.g.  b=mouseb
  2172.                     b=b and 2
  2173.                                       32
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.                     if b<>0 then
  2186.                       print "right button is pressed."
  2187.                     end if
  2188.  
  2189.             SAMPLE8.BAS uses the MOUSEB command
  2190.  
  2191.  
  2192.  
  2193.           MOUSEON
  2194.  
  2195.             This function intializes the mouse.  It returns a -1
  2196.             (true) if a mouse is present.  It returns 0 if no mouse
  2197.             is present.  This function must be issued before the
  2198.             mouse can be used in both DOS and Windows.
  2199.  
  2200.               e.g.  mouseflag=mouseon
  2201.  
  2202.  
  2203.  
  2204.           MOUSEX
  2205.  
  2206.             This function returns the x position of the mouse in
  2207.             character units (1 through 80) for screen mode 0 and in
  2208.             pixel units (0 through top) in all other screen modes.
  2209.  
  2210.               e.g. x=mousex
  2211.  
  2212.  
  2213.  
  2214.           MOUSEY
  2215.  
  2216.             This function returns the y position of the mouse in
  2217.             character units (1 through 25) for screen mode 0 and in
  2218.             pixel units (0 through top) in all other screen modes..
  2219.  
  2220.               e.g.  y=mousey
  2221.  
  2222.  
  2223.  
  2224.           ON CLOSE GOSUB line number
  2225.  
  2226.             This command is ignored under DOS.  This statement
  2227.             defines a subroutine which will be called if the user
  2228.             selects CLOSE from the system menu.  Most programs will
  2229.             not need to use this statement.  However, if you keep
  2230.             important data in in program variables, you may want to
  2231.             prevent the user from terminating your program without
  2232.             giving them an option to save the data.
  2233.  
  2234.             When you receive control because of a close command you
  2235.             can either save important data and stop or execute
  2236.             RETURN and your program will continue running.  Normally
  2237.             you should terminate as soon as possible after receiving
  2238.             control in your close routine.
  2239.                                       33
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.             Here is a simple example of how this statement could be
  2253.             used:
  2254.  
  2255.                      ON CLOSE GOSUB 1000
  2256.  
  2257.                      PRINT "Test of ON CLOSE statement...";
  2258.                      input z
  2259.  
  2260.                      stop
  2261.  
  2262.                 1000 INPUT "Do you want to quit ";a$
  2263.                      IF A$="Y" OR A$="y" THEN
  2264.                        STOP
  2265.                      END IF
  2266.                      RETURN
  2267.  
  2268.           It is important to be aware that Windows can call your ON
  2269.           CLOSE subroutine AT ANY TIME.  Be very careful about using
  2270.           global variables in an ON CLOSE subroutine.  Your main
  2271.           program may not expect them to be changed.
  2272.  
  2273.  
  2274.  
  2275.           ON PAINT GOSUB line number
  2276.  
  2277.             This statement defines a subroutine which handles screen
  2278.             updates.  This statement is ignored in DOS.  This
  2279.             statement is optional in Windows.  See the section on
  2280.             Windows and Graphics for more detail.
  2281.  
  2282.  
  2283.  
  2284.           OPEN filename FOR mode [ACCESS access] AS # [LEN=reclen]
  2285.  
  2286.             This command prepares the file filename for access as
  2287.             number #.  The filename can be a file name with or
  2288.             without a pathname.  Modes supported are INPUT, OUTPUT,
  2289.             APPEND, BINARY, RANDOM.  INPUT, OUTPUT, APPEND are for
  2290.             sequential files.  RANDOM is for random-access files
  2291.             with fixed length records.  BINARY can be used to access
  2292.             any byte of any file.
  2293.  
  2294.             Access types supported are READ, WRITE, or READ WRITE.
  2295.             This argument is optional and is only valid for BINARY
  2296.             and RANDOM files.  READ WRITE is the default.  If you
  2297.             specify READ you will get an error if you try to access
  2298.             a file marked as read-only by DOS.
  2299.  
  2300.             LEN is used for random access files.  It is the record
  2301.             length.  This argument is optional.  128 is the default.
  2302.  
  2303.             e.g.  OPEN "TEST.DAT" FOR INPUT AS #1
  2304.  
  2305.                                       34
  2306.  
  2307.  
  2308.  
  2309.  
  2310.  
  2311.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.             e.g.  OPEN "TEST.DAT" FOR RANDOM ACCESS READ AS #1
  2318.  
  2319.             e.g.  OPEN "TEST.DAT" FOR RANDOM ACCESS READ WRITE AS #1
  2320.  
  2321.             e.g.  OPEN "T.DAT" FOR RANDOM AS #1 LEN=128
  2322.  
  2323.             SAMPLEW2.BAS use the OPEN command.
  2324.  
  2325.  
  2326.  
  2327.           OPEN "COMn: speed,parity,data,stop" FOR RANDOM AS #n LEN=n
  2328.  
  2329.             This statement opens and initializes a communications
  2330.             port.  COM1 and COM2 are supported.  Supported speeds
  2331.             are 9600, 4800,2400,1200,and 300.  Parity may be either
  2332.             E,O,N, or M.  Data may be either 5,6,7, or 8.  Stop may
  2333.             be either 1, 1.5, or 2.  LEN is used to specify the size
  2334.             of the input buffer.  The default is 128 bytes.  For
  2335.             Windows programs a minimum of 2048 is suggested.
  2336.  
  2337.             Only PRINT # will output characters to an open
  2338.             communications port.  Only INPUT$ will receive
  2339.             characters from a port.
  2340.  
  2341.             Communications parameters may be omitted; however, their
  2342.             position must be marked by commas.  Default parameters
  2343.             are 300 baud, No parity, 8 data bits, and 1 stop bit.
  2344.  
  2345.               e.g. OPEN "COM1: 2400,E,7,1" for random as #1 len=2048
  2346.  
  2347.             See the section "Communications Programming" for more
  2348.             details.
  2349.  
  2350.             SAMPLE6.BAS use the OPEN COM command.
  2351.  
  2352.  
  2353.  
  2354.           OPENFILEREAD filterstr,namestr,directorystr,titlestr
  2355.  
  2356.             This statement executes a special Dialog which allows
  2357.             the user to input a file name for input.  See the
  2358.             section "Programming Dialog Boxes" for details.
  2359.  
  2360.             SAMPLE12.BAS and SAMPLEW4.BAS use the OPENFILEREAD
  2361.             command.
  2362.  
  2363.  
  2364.  
  2365.           OPENFILESAVE filterstr,namestr,directorystr,titlestr
  2366.  
  2367.             This statement executes a special Dialog which allows
  2368.             the user to input a file name for writing.  See the
  2369.             section "Programming Dialog Boxes" for details.
  2370.  
  2371.                                       35
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.           OSTYPE
  2388.  
  2389.             This function returns a number indicating what operating
  2390.             system the program is running under.
  2391.  
  2392.                    1 - DOS
  2393.                    2 - Windows 3.x
  2394.                    3 - ?
  2395.  
  2396.  
  2397.  
  2398.           PAINT [STEP](x,y),[paint],[border]
  2399.  
  2400.             This statement fills a graphics area with the color
  2401.             selected.  (x,y) is the first point filled.  It will be
  2402.             filled with the color specified by the attribute
  2403.             'paint', if supplied.  If not supplied the foreground
  2404.             color is used.  Coloring in all directions continues
  2405.             until the 'border' color is encountered.  If border
  2406.             color is not supplied the paint color is used.
  2407.  
  2408.  
  2409.  
  2410.           PALETTE attribute,color
  2411.  
  2412.             This statement allows you to change the default graphic
  2413.             colors provided by BasicBasic.  The usage of the
  2414.             attribute and color arguments depends on the screen mode
  2415.             you are in.  You can always find out your current screen
  2416.             mode using the SYSTEM function.  For Windows programs
  2417.             see the section on WINDOWS AND GRAPHICS for additional
  2418.             information on the PALETTE statement.  Here are the
  2419.             definition of the arguments for various screen modes:
  2420.             screen color.
  2421.  
  2422.             MODE 8
  2423.  
  2424.               Attribute determines which one of the 16 color
  2425.               attributes you want to redefine.  It is the attribute
  2426.               you select with the COLOR statement.  In this mode you
  2427.               have 16 colors to choose from (0 to 15).  See the
  2428.               COLOR statement for a listing of the colors.
  2429.  
  2430.             MODE 9
  2431.  
  2432.               Attribute determines which one of the 16 color
  2433.               attributes you want to redefine.  In this mode you
  2434.               have 64 colors to choose from (0 to 63).
  2435.  
  2436.             MODE 12
  2437.                                       36
  2438.  
  2439.  
  2440.  
  2441.  
  2442.  
  2443.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.               In this mode attribute determines which one of the 16
  2451.               color attributes you want to redefine.  In this mode
  2452.               the color value reflects an exact RGB definition of
  2453.               the color you want.  If you use a variable for color
  2454.               it must be of type long integer.
  2455.  
  2456.                 color= 65536 * blue + 256 * green + red
  2457.  
  2458.               Where blue, green, red can be from 0 to 255.
  2459.  
  2460.  
  2461.  
  2462.           POINT (x,y)
  2463.  
  2464.             This function returns the color of the specified
  2465.             graphics pixel.
  2466.  
  2467.  
  2468.  
  2469.           POS(0)
  2470.  
  2471.             This function returns the current column position of the
  2472.             cursor(starting with 1).  In graphics mode 1000 this
  2473.             function returns the pixel column (starting with 0).
  2474.  
  2475.  
  2476.  
  2477.           POSITION x1,y2,xlen,ylen
  2478.  
  2479.             This statement sizes and positions a window.  x1,y1 are
  2480.             the upper left of the window.  This statement is ignored
  2481.             in DOS.
  2482.  
  2483.  
  2484.  
  2485.           PRESET [STEP](x,y),[color]
  2486.  
  2487.             This command sets one pixel on the screen to the
  2488.             specified color.  By using the STEP prefix you can
  2489.             specify that the x,y coordinates are relative to the
  2490.             current position.  If no color is supplied the pixel is
  2491.             set to the background color.
  2492.  
  2493.  
  2494.  
  2495.           PRINT expressionlist [,|;]
  2496.  
  2497.             Prints the items in expression list.  PRINT with no
  2498.             expression results in a blank line being printed.  If
  2499.             the expression is followed by a semi-colon (;) the next
  2500.             print starts immediately following this one.  If the
  2501.             expression ends in a comma (,) the next print starts at
  2502.             the next print position.  Print positions are at columns
  2503.                                       37
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.             1, 15, 29, etc.
  2516.  
  2517.  
  2518.  
  2519.           PRINT USING formatstring; expressionlist[,|;]
  2520.  
  2521.             The formatstring tells how to print the items in
  2522.             expressionlist.  Any text may be in formatstring.
  2523.             BasicBasic only recognizes three format characters.
  2524.             These are pound sign (#)  comma (,) and period (.).
  2525.             Each time a number character is found (#) one item from
  2526.             the expression list will be printed.
  2527.  
  2528.                e.g. PRINT USING "The answer is: ###,###.##";number
  2529.  
  2530.  
  2531.  
  2532.           PRINT #filenumber,expressonlist
  2533.  
  2534.             Prints to a file or communications port the items in
  2535.             expression list.
  2536.  
  2537.  
  2538.  
  2539.           PSET [STEP](x,y),[color]
  2540.  
  2541.             This command sets one pixel on the screen to the
  2542.             specified color.  By using the STEP prefix you can
  2543.             specify that the x,y coordinates are relative to the
  2544.             current position.  If no color is supplied the pixel is
  2545.             set to the foreground color.
  2546.  
  2547.  
  2548.  
  2549.           PUT (x,y),arrayname,action
  2550.  
  2551.             This statement places pixels stored in an array onto the
  2552.             screen.  (x,y) is the upper left position.  The x and y
  2553.             length placed on the screen depends on the GET statement
  2554.             which stored the data into the array.
  2555.  
  2556.             The action may be one of the following:
  2557.  
  2558.                   XOR  - Combines the pixels in the array and those
  2559.                          on the screen using the XOR operator.
  2560.                          This is the most common action used for
  2561.                          motion since this automatically restores
  2562.                          the background when done twice.  XOR is
  2563.                          the default.
  2564.  
  2565.                  PSET  - Transfers data erasing what is already on
  2566.                          the screen.
  2567.  
  2568.                PRESET  - Inverts data and transfers to screen
  2569.                                       38
  2570.  
  2571.  
  2572.  
  2573.  
  2574.  
  2575.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2576.  
  2577.  
  2578.  
  2579.  
  2580.  
  2581.                          erasing what is already on the screen.
  2582.  
  2583.                   AND  - Masks screen image with data in array.
  2584.  
  2585.                    OR  - Superimposes data on existing screen.
  2586.  
  2587.             For Windows use see the section WINDOWS AND GRAPHICS for
  2588.             more information.
  2589.  
  2590.  
  2591.           PUT #filenumber,recordnumber,stringexpression
  2592.           PUT #filenumber,recordnumber
  2593.  
  2594.             This statement is used to output data to a file opened
  2595.             in either BINARY or RANDOM mode.
  2596.  
  2597.             In BINARY mode the string expression will be written to
  2598.             the file at the byte location given by recordnumber.
  2599.             Recordnumber is the absolute byte number to be written,
  2600.             where the first byte of the file is 1.
  2601.  
  2602.               e.g. A$=SPACE$(20)
  2603.                    PUT #1,100,A$  (writes 20 bytes starting at 100)
  2604.  
  2605.  
  2606.             In RANDOM mode the data in the output buffer will be
  2607.             written to the record number indicated.
  2608.  
  2609.               e.g. PUT #1,1    (writes to record 1)
  2610.  
  2611.  
  2612.  
  2613.           RADIOON keycode
  2614.  
  2615.             This command 'checks' the indicated Radio button.  See
  2616.             the section "Programming Buttons" for more information.
  2617.  
  2618.  
  2619.  
  2620.           RADIOOFF keycode
  2621.  
  2622.             This command 'unchecks' the indicated Radio button.  See
  2623.             the section "Programming Buttons" for more information.
  2624.  
  2625.  
  2626.  
  2627.           RANDOMIZE
  2628.  
  2629.             This statement initializes the random number generator.
  2630.             If you use the RND function you probably want to preceed
  2631.             it's use with the RANDOMIZE statement.  Otherwise
  2632.             everytime your program runs you will get the same
  2633.             sequence of 'random' numbers.  This statement has no
  2634.             arguments.
  2635.                                       39
  2636.  
  2637.  
  2638.  
  2639.  
  2640.  
  2641.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2642.  
  2643.  
  2644.  
  2645.  
  2646.  
  2647.  
  2648.  
  2649.  
  2650.           READ variablelist
  2651.  
  2652.             Inputs a value from a DATA statement.
  2653.  
  2654.  
  2655.  
  2656.           REM
  2657.  
  2658.             Denotes a comment line and is ignored by the compiler.
  2659.  
  2660.  
  2661.  
  2662.           RESTORE label
  2663.  
  2664.             Sets position that next READ statement will input data
  2665.             from.
  2666.  
  2667.  
  2668.  
  2669.           RETURN
  2670.  
  2671.             Returns program execution to location immediately after
  2672.             last GOSUB.
  2673.  
  2674.  
  2675.  
  2676.           RIGHT$(stringexpression,n)
  2677.  
  2678.             This function returns a string of length n from the
  2679.             right part of stringexpression
  2680.  
  2681.  
  2682.  
  2683.           RMDIR stringexpression
  2684.  
  2685.             This command removes the directory given by
  2686.             stringexpression.
  2687.  
  2688.  
  2689.  
  2690.           RND
  2691.  
  2692.             This function returns one in a sequence of random
  2693.             numbers between 0 and 1.
  2694.  
  2695.  
  2696.           SCREEN mode[,palette][,peflag]
  2697.  
  2698.             This statement selects the screen mode.  The actual
  2699.             screen mode available depends on your hardware.  The
  2700.             modes available in this version of BasicBasic are:
  2701.                                       40
  2702.  
  2703.  
  2704.  
  2705.  
  2706.  
  2707.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.              0 - Text Only.  This is the default.
  2715.  
  2716.              2 - 640-200 Graphics.  Black and white only.
  2717.                  80 x 25 text format. (CGA, EGA, VGA)
  2718.  
  2719.              8 - 640-200 Graphics.  16 colors and 16 attributes
  2720.                  80 x 25 text format (EGA,VGA)
  2721.  
  2722.              9 - 640-350 Graphics.  16 colors and 16 attributes
  2723.                  80 x 25 text format (EGA,VGA)
  2724.  
  2725.             12 - 640-480 Graphics.  256,000 colors and 16 attributes
  2726.                  80 x 30 text format (VGA)
  2727.  
  2728.             1000 - Special mode.  Supports whatever graphics
  2729.                  resolution Windows supports or, under DOS, the
  2730.                  highest resolution the monitor supports.  Under
  2731.                  Windows supports font generation  Issueing a SCREEN
  2732.                  1000 under DOS results in selection of the highest
  2733.                  available graphics mode (2, 8, 9 or 12).
  2734.  
  2735.             The Palette argument is ignored under DOS. Under Windows
  2736.             it allows you to select the special BasicBasic palette
  2737.             if set to 16, or to select the 'system palette' if set
  2738.             to 0.  If the Palette argument is omitted then the
  2739.             default is 0, use the system palette.  If hardware
  2740.             supports you can also set up to 256 for 256 color
  2741.             selection.  See the section WINDOWS AND GRAPHICS for
  2742.             more detail.
  2743.  
  2744.             The peflag argument is ignored under DOS.  Under Windows
  2745.             this flag can be set to 1 to prevent other programs from
  2746.             using palette entries supplied by your logical palette
  2747.             or 4 to specify that you do not want to use any palette
  2748.             entries supplied by other programs.  The default value
  2749.             is 0 and there is seldom a reason to change this.
  2750.  
  2751.             Here are examples of how the SCREEN command might be
  2752.             used under Windows.
  2753.  
  2754.                 SCREEN 8         -- system palette
  2755.                 SCREEN 8,0       -- system palette
  2756.                 SCREEN 8,16      -- special BasicBasic palette
  2757.                 SCREEN 1000,256  -- special BasicBasic palette
  2758.  
  2759.             Under Windows if you select 256 color mode on a machine
  2760.             with a palette size of 256, then Windows only allows you
  2761.             to change 236 of the palette entries.  Entries 0->9 and
  2762.             246->255 are fixed and may not be changed.  The fixed
  2763.             windows colors are different from the standard, default
  2764.             Basic Colors
  2765.  
  2766.             If you do not know the output capabilites of the machine
  2767.                                       41
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2774.  
  2775.  
  2776.  
  2777.  
  2778.  
  2779.             your program is going to run on, use the SETERRLEVEL
  2780.             command to determine if a screen mode has been
  2781.             successful.  Here is an example:
  2782.  
  2783.                     SETERRLEVEL 5
  2784.                     ERR=0
  2785.                     SCREEN 12
  2786.                     IF ERR>0 THEN
  2787.                       ERR=0
  2788.                       SCREEN 9
  2789.                       IF ERR>0 THEN
  2790.                         ERR=0
  2791.                         SCREEN 8
  2792.                         IF ERR>0 THEN
  2793.                           PRINT "GRAPHICS NOT AVAILABLE."
  2794.                           STOP
  2795.                         END IF
  2796.                       END IF
  2797.                     END IF
  2798.  
  2799.             The SCREEN command resets SCROLLAREA to entire screen.
  2800.  
  2801.             SAMPLE7.BAS uses the SCREEN command
  2802.  
  2803.  
  2804.  
  2805.  
  2806.           SCROLLAREA leftx,topy,rightx,bottomy
  2807.  
  2808.             This statement defines an area of the screen which is
  2809.             used for scrolling.  This allows you to create fixed
  2810.             text or buttons in one area of the screen while
  2811.             scrolling another area.  In screen modes less than 1000
  2812.             Leftx, topy, rightx, bottomy are in character units and
  2813.             are inclusive(starting with 1).  In screen mode 1000
  2814.             leftx, topy, rightx, bottomy are pixel units(starting
  2815.             with 0).
  2816.  
  2817.             Executing the CLS command will clear the entire screen,
  2818.             not just the scrollable area.  PRINT CHR$(12); will only
  2819.             clear the scrollable area.
  2820.  
  2821.  
  2822.  
  2823.           SELECTBITMAP bitmapnumber
  2824.  
  2825.             This command is ignored under DOS.  Under Windows this
  2826.             command assigns screen output to a memory bitmap or back
  2827.             to the screen again.  A bitmapnumber=0 signifies the
  2828.             screen; 1 or 2 signify one of the two possible memory
  2829.             bitmaps previously created with the CREATEBITMAP
  2830.             command.  DO NOT perform input operations, define
  2831.             buttons, or call Dialogs while a memory bitmap is
  2832.             selected!
  2833.                                       42
  2834.  
  2835.  
  2836.  
  2837.  
  2838.  
  2839.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2840.  
  2841.  
  2842.  
  2843.  
  2844.  
  2845.  
  2846.             The following example draws and fills rectangles on a
  2847.             memory bitmap and then copies it to the screen.
  2848.  
  2849.                  pxsize=100
  2850.                  pysize=100
  2851.                  createbitmap 1,0,pxsize,pysize
  2852.                  selectbitmap 1
  2853.                  c=1
  2854.                  for i=0 to 90 step 10
  2855.                    line (i,0)-(i+10,100),c,bf
  2856.                    c=c+1
  2857.                  next i
  2858.                  selectbitmap 0
  2859.                  copybits 0,0,0,100,100,1,0,0,0
  2860.  
  2861.  
  2862.  
  2863.           SETCOM comnum,"Speed,Parity,Databits,Stopbits,dtr,rts"
  2864.  
  2865.             This statement allows you to change communications
  2866.             parameters for an already opened communications port.
  2867.             Speed, Parity, Databits, and Stopbits are described in
  2868.             OPEN COM.  DTR may be either ON or OFF.  If ON then the
  2869.             output data terminal ready signal will be set high.  ON
  2870.             is the default.  RTS may be either 1 or 0.  If 1 then
  2871.             the output request to send is high.  1 is the default.
  2872.             Communications parameters not present will not be
  2873.             changed; however, a comma must mark their positions.
  2874.  
  2875.                e.g. SETCOM 1,",,7"
  2876.  
  2877.                      Sets number of data bits to 7.
  2878.  
  2879.                e.g. SETCOM 1,",,,,OFF"
  2880.  
  2881.                     Turns Data terminal read;y off.
  2882.  
  2883.             See the section "Communications Programming" for more
  2884.             information.
  2885.  
  2886.  
  2887.  
  2888.           SETERRLEVEL level
  2889.  
  2890.             This command defines what BasicBasic should do in case
  2891.             of runtime errors.  Level must be a number (not an
  2892.             expression or variable).  Level 7 causes execution to
  2893.             halted for all errors.  Level 5 causes execution to
  2894.             continue for recoverable errors.  In the latter case the
  2895.             global variable ERR is set to the error number.  ERR may
  2896.             be reset with the statement:  ERR=0.  ERR will be reset
  2897.             each time an error occurs so the program must check ERR
  2898.             immediately after statements which may produce errors.
  2899.                                       43
  2900.  
  2901.  
  2902.  
  2903.  
  2904.  
  2905.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914.           SHELL [string]
  2915.  
  2916.             This command runs another program.  String may contain
  2917.             an optional command string to pass to the called
  2918.             program.
  2919.  
  2920.               e.g.   SHELL WRITE  MYFILE.WRI
  2921.  
  2922.               Would call the application WRITE and pass it the
  2923.               command string MYFILE.WRI.
  2924.  
  2925.  
  2926.  
  2927.           SIN(x)
  2928.  
  2929.             This function returns the sine of an angle expressed in
  2930.             radians.
  2931.  
  2932.  
  2933.  
  2934.           SOUND frequency,duration
  2935.  
  2936.             This command issues tones through the computer speaker.
  2937.             The frequency is the desired frequency in cycles per
  2938.             second(cps).  The duration is the multiple of the clock
  2939.             frequency (i.e. 18.2).
  2940.  
  2941.  
  2942.  
  2943.           SPACE$(N)
  2944.  
  2945.             Returns a string of n spaces.
  2946.  
  2947.  
  2948.  
  2949.           STOP
  2950.  
  2951.             Causes the program to cease execution.
  2952.  
  2953.  
  2954.  
  2955.           STOREBITMAP 0,filename,x,y,xsize,ysize,cv,0
  2956.  
  2957.             This statement stores the designated portion of the
  2958.             display to a bitmap file with the designated name.  X,y
  2959.             are the upper left screen coordinates.  If cv is set to
  2960.             1 then the file will be stored in run-length-encoded
  2961.             compressed format if possible.
  2962.  
  2963.             See the section BITMAPS for further information.
  2964.  
  2965.                                       44
  2966.  
  2967.  
  2968.  
  2969.  
  2970.  
  2971.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  2972.  
  2973.  
  2974.  
  2975.  
  2976.  
  2977.  
  2978.  
  2979.           STR$(numericexpression)
  2980.  
  2981.            This function returns a string representation of the
  2982.            numbericexpression.
  2983.  
  2984.  
  2985.  
  2986.           STRING$(m,stringexpression)
  2987.  
  2988.             This function returns a string of length n.  This string
  2989.             is composed of the first character in stringexpression.
  2990.  
  2991.  
  2992.  
  2993.           SUB
  2994.  
  2995.             This statement is used at the beginning of a SUB
  2996.             procedure.  See the CALL statement for an example.
  2997.  
  2998.  
  2999.  
  3000.           SYSTEM (n)
  3001.  
  3002.             This function returns information on the screen
  3003.             depending on the value of n passed to it.  This
  3004.             information is of most use to Windows programs.
  3005.  
  3006.                 n       function returns
  3007.                ---    ----------------------------------
  3008.                 1     Maximum x allowed in a graphics program
  3009.                 2     Maximum y allowed in a graphics program
  3010.                 3     Actual maximum screen size x
  3011.                 4     Actual maximum screen size y
  3012.                 5     Maximum color attribute
  3013.                 6     Maximum 'background color' in COLOR statement
  3014.                 7     Current screen mode
  3015.                 8     Window left position
  3016.                 9     Window top position
  3017.                 10    Window x size
  3018.                 11    Window y size
  3019.                 12    Returns 1 if window is Active Window, 0
  3020.                       otherwise.  See WINDOWS AND GRAPHICS for
  3021.                       more information on uses of this value.
  3022.                 13    DOS major version number (e.g. 5)
  3023.                 14    DOS minor version number (e.g. 0)
  3024.                 15    Windows major version number (e.g. 3)
  3025.                 16    Windows minor version number (e.g. 1)
  3026.                 17    Hardware Palette Size
  3027.  
  3028.  
  3029.           TAB(numericexpression)
  3030.  
  3031.                                       45
  3032.  
  3033.  
  3034.  
  3035.  
  3036.  
  3037.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3038.  
  3039.  
  3040.  
  3041.  
  3042.  
  3043.             In PRINT or LPRINT statements positions output at column
  3044.             position given in numericexpression.
  3045.  
  3046.  
  3047.  
  3048.           TAN(x)
  3049.  
  3050.             This function returns the tangent of an angle expressed
  3051.             in radians.
  3052.  
  3053.  
  3054.  
  3055.           TIME$
  3056.  
  3057.             This function returns a string representation of the
  3058.             current system time.
  3059.  
  3060.  
  3061.  
  3062.           TIMER
  3063.  
  3064.             This function returns the number of seconds since
  3065.             midnight.
  3066.  
  3067.  
  3068.  
  3069.           UCASE$(stringexpression)
  3070.  
  3071.             This function converts all lower case characters in
  3072.             stringexpression to upper case and returns as new
  3073.             string.
  3074.  
  3075.  
  3076.  
  3077.           VAL(stringexpression)
  3078.  
  3079.             This function returns the numeric value of string
  3080.             stringexpression.
  3081.  
  3082.  
  3083.  
  3084.           WRITE #filenumber,expression list
  3085.  
  3086.             Write is performs the same way as Print with these
  3087.             exceptions:  1) Commas are inserted between all items;
  3088.             2) Strings are bracketed by quotation marks.
  3089.  
  3090.             BasicBasic does not support using the Write statement to
  3091.             display on the screen.
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.                                       46
  3098.  
  3099.  
  3100.  
  3101.  
  3102.  
  3103.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.           GRAPHICS PROGRAMMING FOR BEGINNERS
  3110.           -------------------------------------------------------
  3111.           
  3112.           This section will show you the basics of graphics
  3113.           programming in BasicBasic.  The examples given will work
  3114.           equally well running under DOS or Windows.
  3115.  
  3116.           Now here is your first graphics program:
  3117.  
  3118.                   SCREEN 2
  3119.                   LINE (0,0)-(400,100)
  3120.                   INPUT Z
  3121.  
  3122.           This program draws one diagonal line on the screen.  The
  3123.           key to graphics programming is the SCREEN command.  You
  3124.           must issue a SCREEN command to tell BasicBasic that you
  3125.           are going to do graphics.  Screen 2 puts your screen into
  3126.           a graphics mode with 640 dots (pixels) across and 200 dots
  3127.           down.  Each dot is either white or black.  Most of our
  3128.           examples will use SCREEN 8, which has the same number of
  3129.           dots, but 16 colors.  If you are running on a CGA display,
  3130.           SCREEN 2 is the only graphics mode available, so you will
  3131.           have to adjust these examples.
  3132.  
  3133.           The second line in our example contains the LINE
  3134.           statement.  The LINE statement will do much more than make
  3135.           lines.  It will also create boxes and fill them with a
  3136.           color if you want.  Here is another program:
  3137.  
  3138.                   SCREEN 8
  3139.                   LINE (0,0)-(400,100),4,B
  3140.                   INPUT Z
  3141.  
  3142.           This program puts the hardware into a 16 color mode and
  3143.           then creates a box with red lines.  The 'B' at the end of
  3144.           the statement is what tells it to make a box.  Notice that
  3145.           the diagonal line is not drawn on the screen.  Instead the
  3146.           end points in the statement are used as the opposing
  3147.           corners of the box.  The 4 specifies the color red.  You
  3148.           could also do the following:
  3149.  
  3150.                   SCREEN 8
  3151.                   LINE (0,0)-(400,100),4,BF
  3152.                   INPUT Z
  3153.  
  3154.           This program has 'BF' instead of 'B' in the LINE
  3155.           statement.  The 'BF' says to draw a box and then fill it
  3156.           with the same color.
  3157.  
  3158.           Of course you can also use a variable in place of the
  3159.           numeric constants we have used so far:
  3160.  
  3161.                   SCREEN 8
  3162.                   FOR I=0 TO 15
  3163.                                       47
  3164.  
  3165.  
  3166.  
  3167.  
  3168.  
  3169.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3170.  
  3171.  
  3172.  
  3173.  
  3174.  
  3175.                     X=I*10
  3176.                     Y=I*5
  3177.                     MYCOLOR=I
  3178.                     LINE (X,Y)-(X+10,Y+10),MYCOLOR,B
  3179.                   NEXT I
  3180.                   INPUT Z
  3181.  
  3182.           This creates a series of boxes.
  3183.  
  3184.           If you are tired of sharp corners try this:
  3185.  
  3186.                   SCREEN 8
  3187.                   CIRCLE (100,100),50,4
  3188.                   INPUT Z
  3189.  
  3190.           As you might expect this draws a circle.  The center of
  3191.           the circle is at 100,100; it has a radius of 50 and is
  3192.           drawn in red(the 4).  The CIRCLE statement will do much
  3193.           more than draw circles; it will also draw arcs and pie
  3194.           sections.  Try this:
  3195.  
  3196.                   SCREEN 8
  3197.                   CIRCLE (100,100),50,4,0,3.1416/2
  3198.                   INPUT Z
  3199.  
  3200.           This draws a quarter circle (an arc) starting to the right
  3201.           and finishing up at the top.  To do this we are added 2
  3202.           more arguments to the CIRCLE statement; 0 and 3.1416/2.
  3203.           These are the start and end angles in radians of the arc.
  3204.           There are 2pi radians in a circle.  Don't remember this
  3205.           from high school?  Just remember that 0 is to the right;
  3206.           3.1416/2 is up, 3.1416 is left, and 4.7124 is down.
  3207.  
  3208.           Putting a minus sign before the start and end angles cause
  3209.           BasicBasic to draw a pie section.
  3210.  
  3211.                   SCREEN 8
  3212.                   CIRCLE (100,100),50,4,-.01,-2
  3213.                   INPUT Z
  3214.  
  3215.           This draws a pie section slightly greater than a quarter
  3216.           circle.  The CIRCLE statement does not have a fill option
  3217.           like the LINE statement.  If you want to fill your pie
  3218.           section with a color you should use the PAINT statement.
  3219.           This is a very versatile statement.  You use it like this:
  3220.  
  3221.                   SCREEN 8
  3222.                   CIRCLE (100,100),50,4,-.01,-2
  3223.                   PAINT (102,98),4,4
  3224.                   INPUT Z
  3225.  
  3226.           Now we have a red pie section.  Paint starts filling the
  3227.           screen with color starting with the center point given and
  3228.           proceeding to the border color.  Notice that we made our
  3229.                                       48
  3230.  
  3231.  
  3232.  
  3233.  
  3234.  
  3235.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3236.  
  3237.  
  3238.  
  3239.  
  3240.  
  3241.           center point different than 100,100 to make sure it was
  3242.           inside the pie section we previously drew with the CIRCLE
  3243.           command.  We could have a blue pie section with red border
  3244.           with the following:
  3245.  
  3246.                   SCREEN 8
  3247.                   CIRCLE (100,100),50,4,-.01,-2
  3248.                   PAINT (102,98),1,4
  3249.  
  3250.           We will mention one last statement in this introductory
  3251.           discussion.  This is the PSET statement.  It allows you
  3252.           set individula pixels on the screen.
  3253.  
  3254.                   SCREEN 8
  3255.                   FOR I=1 TO 100
  3256.                     MYCOLOR=INT(RND*16)
  3257.                     X=INT(RND*640)
  3258.                     Y=INT(RND*200)
  3259.                     PSET (X,Y),MYCOLOR
  3260.                   NEXT I
  3261.                   INPUT Z
  3262.  
  3263.           The preceeding program 'splatters' 100 randomly placed
  3264.           pixels on the screen.  They also have random color.
  3265.  
  3266.           We won't discuss them here but other statements useful in
  3267.           graphics programming are:
  3268.  
  3269.                   PRESET
  3270.                   GET
  3271.                   PUT
  3272.                   COLOR
  3273.                   PALETTE
  3274.  
  3275.           Refer to the graphics programming examples SAMPLEG1.BAS,
  3276.           SAMPLEG2.BAS, SAMPLEG3.BAS and SAMPLEG4.BAS for more ideas
  3277.           on graphics programming.
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.                                       49
  3296.  
  3297.  
  3298.  
  3299.  
  3300.  
  3301.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3302.  
  3303.  
  3304.  
  3305.  
  3306.  
  3307.  
  3308.           PROGRAMMING BUTTONS
  3309.           -------------------------------------------------------
  3310.           
  3311.           Buttons can be used in either DOS or Windows.  Buttons do
  3312.           not require the presence of a mouse.  Here is an example
  3313.           of a valid create button command:
  3314.  
  3315.               CBUTTON "EXIT",1068,0,"Push",0,1,1,8,1,7,4
  3316.  
  3317.           Here is a description of each parameter:
  3318.  
  3319.             EXIT - This is the name displayed in the button
  3320.  
  3321.             1068 - This is keycode for F10 (User can either
  3322.                    use mouse to push button or press F10.
  3323.  
  3324.             0    - Reserved
  3325.  
  3326.             Push - Type of button.  'Radio' is the other type.
  3327.  
  3328.             0    - Reserved
  3329.  
  3330.             1    - Left position
  3331.  
  3332.             1    - Y position
  3333.  
  3334.             8    - x size (in characters)
  3335.  
  3336.             1    - y size (in characters)
  3337.  
  3338.             7    - foreground color (In Windows only used for Radio
  3339.                    buttons).
  3340.  
  3341.             4    - background color (In Windows only used for Radio
  3342.                    buttons).
  3343.  
  3344.           In DOS a push button will have text centered and if the
  3345.           defined text size is at least 2 characters smaller than
  3346.           the button size a line will be drawn around the outside.
  3347.  
  3348.           In graphics modes button position and size is given in
  3349.           pixel units rather than character units.
  3350.  
  3351.           Remember that if a mouse is going to be used it MUST be
  3352.           turned on with the MOUSEON function before it can be used
  3353.           to press a button.
  3354.  
  3355.           Here is an example of a small program which uses buttons:
  3356.  
  3357.                 A=MOUSEON
  3358.                 IF A=-1 THEN
  3359.                   CBUTTON "EXIT",1068,0,"PUSH",0,70,1,8,1,0,0
  3360.                 ELSE
  3361.                                       50
  3362.  
  3363.  
  3364.  
  3365.  
  3366.  
  3367.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3368.  
  3369.  
  3370.  
  3371.  
  3372.  
  3373.                   CBUTTON "F10-Exit",1068,0,"PUSH",0,70,1,10,1,0,0
  3374.                 END IF
  3375.                 INPUT Z
  3376.                 a$=INKEY$
  3377.                 PRINT LEN(A$)
  3378.  
  3379.             This program displays different text in the button
  3380.             depending on whether a mouse is present or not.
  3381.             Assuming there is a mouse this program will end under
  3382.             the following conditions:
  3383.  
  3384.                - User presses EXIT button with mouse
  3385.                - User presses F10 on keyboard
  3386.                - User presses ENTER key on keyboard.
  3387.  
  3388.             In the first two cases the print will show a length of 2
  3389.             for the length of A$ since the button keycode will be
  3390.             returned on the next INKEY$ after the INPUT is
  3391.             terminated.
  3392.  
  3393.           Once you have created a button you are responsible for NOT
  3394.           writing anything to that area of the screen.  If you do
  3395.           the button will be erased.  If you are using buttons and
  3396.           scrolling text on the screen make sure you use the
  3397.           SCROLLAREA command to protect the button area of the
  3398.           screen.
  3399.  
  3400.           INVISIBLE buttons can be particularly useful.  An
  3401.           invisible button does not appear on the screen, but a
  3402.           button push inside it's defined area will return it's
  3403.           keycode just as if it were.  This allows you to create
  3404.           your own special color buttons or input areas.  For
  3405.           instance you could have a series of INPUT statements in a
  3406.           program and each could be defined as an invisible button.
  3407.           When the user clicked on that input area you would get a
  3408.           unique keycode which would direct your program to the
  3409.           section of code which handles that input.
  3410.  
  3411.           Since buttons end INPUT commands you can also use
  3412.           invisible buttons to define any keys you want to end INPUT
  3413.           commands (e.g. UP ARROW or DOWN ARROW).
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.                                       51
  3428.  
  3429.  
  3430.  
  3431.  
  3432.  
  3433.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3434.  
  3435.  
  3436.  
  3437.  
  3438.  
  3439.  
  3440.           PROGRAMMING MENUS
  3441.           -------------------------------------------------------
  3442.           
  3443.           Under DOS menus may be either accessed by using the mouse
  3444.           (if present) or pressing the F10 key. (F10 is changeable,
  3445.           see the definition of MAINMENU command)  When using menus
  3446.           in DOS, always define menus BEFORE creating buttons.
  3447.           Also, be aware that using the PALETTE command when a menu
  3448.           bar is displayed may change the color of the menu bar or
  3449.           may it invisible.
  3450.  
  3451.           Menus support in BasicBasic is much like button support.
  3452.           When the user selects a menu item a defined keycode is
  3453.           returned to the Basic program.  Menu keycodes are returned
  3454.           only using the INKEY$ function call.  However, if the user
  3455.           selects a menu item while the program is waiting for input
  3456.           in an INPUT command the input command will be terminated
  3457.           just as if the user had pressed Enter.  Then on the next
  3458.           INKEY$ call the keycode for the menu item will be
  3459.           returned.
  3460.  
  3461.           KEYCODES:  Just as in buttons keycodes can be regular or
  3462.           extend keys.  Extended keys are indicated by adding 1000
  3463.           to the regular keycode.  F10 would be 1068.  See the
  3464.           Appendix 'Keyboard codes' for a complete list.
  3465.  
  3466.           The mouse must be enable with the MOUSEON command before
  3467.           any menu items will be recognized.
  3468.  
  3469.           Here is an example of a simple Windows program which
  3470.           utilizes menus.
  3471.  
  3472.                 y=mouseon
  3473.                 mainmenu "Color","","","","",""
  3474.                 addsubmenu 1,"Black",1059
  3475.                 addsubmenu 1,"White",1061
  3476.                 backcolor=0
  3477.                 menuitemgray 1059
  3478.              50
  3479.                 cls
  3480.                 color 1,backcolor
  3481.                 locate 10,30
  3482.                 print "Sample text..";
  3483.              100
  3484.                 a$=inkey$
  3485.                 if a$="" then goto 100
  3486.                 if len(a$)=1 then goto 100
  3487.                 if right$(a$,1)=chr$(59)
  3488.                   menuitemon 1060
  3489.                   menuitemgray 1059
  3490.                   backcolor=7
  3491.                   goto 50
  3492.                 elseif right$(a$,1)=chr$(60)
  3493.                                       52
  3494.  
  3495.  
  3496.  
  3497.  
  3498.  
  3499.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3500.  
  3501.  
  3502.  
  3503.  
  3504.  
  3505.                   menuitemon 1059
  3506.                   menuitemgray 1060
  3507.                   backcolor=0
  3508.                   goto 50
  3509.                 end if
  3510.                 goto 100
  3511.  
  3512.           This program defines one menu and then adds two items to
  3513.           it.  These menu items allow the user to clear the screen
  3514.           to either black or white.  The program disables the menu
  3515.           item for whatever color the screen currently is.
  3516.  
  3517.           The menu could be define in the following way also.
  3518.  
  3519.                   mainmenu "&Color","","","","",""
  3520.                   addsubmenu 1,"&Black",1059
  3521.                   addsubmenu 1,"&White",1061
  3522.  
  3523.           The apersand (&) allows you to define which character in
  3524.           the menu will be underlined which allows the user to
  3525.           select this item by pressing the ALT key and this letter.
  3526.           This IS NOT the keycode which will be returned to your
  3527.           program.  This keycode will always be the one given as the
  3528.           last parameter of the addsubmenu command.
  3529.  
  3530.           We could also define the menu like this:
  3531.  
  3532.                   mainmenu "&Color","","","","",""
  3533.                   addsubmenu 1,"&Black",1059
  3534.                   addsubmenu 1,"",0
  3535.                   addsubmenu 1,"&White",1061
  3536.  
  3537.           The 3rd line (addsubmenu 1,"",0) creates a line seperator
  3538.           in the menu bar.  It can not be selected by the user.
  3539.  
  3540.  
  3541.  
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.                                       53
  3560.  
  3561.  
  3562.  
  3563.  
  3564.  
  3565.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.           PROGRAMMING DIALOG BOXES
  3573.           -------------------------------------------------------
  3574.           
  3575.           Dialog Boxes are 'pop-up' boxes used to get information
  3576.           from the user.  Dialog Boxes are made up of one or more
  3577.           'Controls'.  A Control may be a pushbutton, radio button,
  3578.           check box, edit field or various other items.
  3579.  
  3580.           BasicBasic contains 3 types of Dialogs boxes: 1) File open
  3581.           for read; 2) File open for save; 3) User defined.
  3582.  
  3583.           Dialogs automatically preserve the original screen over
  3584.           which they are place.  The original screen is restored
  3585.           when the dialog closes.
  3586.  
  3587.           Under both DOS and Windows a user can selected and enter
  3588.           items in a Dialog box without a mouse.  Use the TAB key to
  3589.           move from item to item.  Arrow keys select items in a
  3590.           list.  Space bar sets/resets radio buttons and checkboxes.
  3591.           Pressing Enter exists the dialog box if on a pushbutton.
  3592.  
  3593.  
  3594.           FILE OPEN FOR READ DIALOG BOX:
  3595.  
  3596.           This dialog box is available under any version of DOS, but
  3597.           if running under Windows it is only available under
  3598.           Windows Version 3.1 or later.  (See the SYSTEM function
  3599.           for information on determining Windows version.)  This is
  3600.           a very easy to use dialog box which prompts the operator
  3601.           to select a file to be read from.  The format of the
  3602.           command is as follows:
  3603.  
  3604.              OPENFILEREAD filterstr,filenamestr,directorystr,title
  3605.  
  3606.           An example would be:
  3607.  
  3608.                  filter$="document"+chr$(0)+"*.doc"+chr$(0)+chr$(0)
  3609.                  filename$="readme.doc"
  3610.                  directory$="c:\windows"
  3611.                  title$="My open dialog"
  3612.                  OPENFILEREAD FILTER$,FILENAME$,DIRECTORY$,TITLE$
  3613.  
  3614.           Filter defines which file names will be display for the
  3615.           user.  Each filter is a pair of text strings seperated by
  3616.           a chr$(0) character.  The first string of the pair is a
  3617.           description of the filter and the second part is the
  3618.           filter (e.g. *.BAT).  You may have more than one filter;
  3619.           however, in DOS, only the first filter is used.
  3620.  
  3621.           Filename defines the default file (if any).
  3622.  
  3623.           Directory defines the default pathname (if any).
  3624.  
  3625.                                       54
  3626.  
  3627.  
  3628.  
  3629.  
  3630.  
  3631.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.           Title is an optional title for the dialog box.
  3638.  
  3639.           Upon leaving the dialog box the following functions return
  3640.           the result:
  3641.  
  3642.              DIALOG$(100) has the file name
  3643.              DIALOG$(101) has the pathname
  3644.              DIALOG$(102) is set to 1 if successful, 0 else
  3645.              DIALOG$(103) is set to 1 if Cancel button pressed
  3646.                           102 and 103 will both be zero if an
  3647.                           error occurs.
  3648.  
  3649.           If the dialog was successful then the default disk and
  3650.           directory will have been changed to the pathname returned
  3651.           in DIALOG$(101).  The path is returned for informational
  3652.           purposes only.
  3653.  
  3654.  
  3655.           FILE OPEN FOR WRITE DIALOG BOX:
  3656.  
  3657.           This dialog box is available under any version of DOS, but
  3658.           if running under Windows it is available only under
  3659.           Windows 3.1 or later.  This dialog box is similar to
  3660.           OPENFILEREAD.  The primary difference is that OPENFILEREAD
  3661.           requires that the file exist, while OPENFILEWRITE does
  3662.           not.
  3663.  
  3664.              OPENFILESAVE filterstr,filenamestr,directorystr,title
  3665.  
  3666.           An example would be:
  3667.  
  3668.                  filter$="document"+chr$(0)+"*.doc"+chr$(0)+chr$(0)
  3669.                  filename$="readme.doc"
  3670.                  directory$="c:\windows"
  3671.                  title$="My open dialog"
  3672.                  OPENFILEREAD FILTER$,FILENAME$,DIRECTORY$,TITLE$
  3673.  
  3674.  
  3675.           USER DEFINED DIALOG BOXES:
  3676.  
  3677.           To create and use a dialog box you must do the following
  3678.           steps:  1) Create a string array to hold Control
  3679.           information;  2) Define one control in each string array
  3680.           element;  3) Execute the dialog using the DIALOG
  3681.           statement;  4) Use information acquired in Dialog.
  3682.  
  3683.           The DIALOG statement looks like this:
  3684.  
  3685.             DIALOG, a$(),x,y,xlen,ylen,id,string name
  3686.  
  3687.             where:
  3688.  
  3689.               a$() = a string array
  3690.               x    = x position of upper left corner
  3691.                                       55
  3692.  
  3693.  
  3694.  
  3695.  
  3696.  
  3697.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.               y    = y position of upper left corner
  3704.               xlen = x length
  3705.               ylen = y length
  3706.               id   = unique identifier for control (1 -> 255)
  3707.               string name = Text to put at top of Dialog box
  3708.  
  3709.           X, y, xlen, ylen are in pixels in graphics mode or in
  3710.           character locations in text mode (SCREEN 0).
  3711.  
  3712.           An example would be:
  3713.  
  3714.             DIALOG  A$(0),10,10,200,100,100,"GET INFO"
  3715.  
  3716.           Each Control is then defined in one element of the string
  3717.           array.  The general format for controls is:
  3718.  
  3719.                controltype,x,y,xlen,ylen,id,text
  3720.  
  3721.           Commas between each element are required.
  3722.  
  3723.           An example would be:
  3724.  
  3725.              a$(0)="pushbutton,5,40,100,30,100,Exit"
  3726.  
  3727.              This would define a pushbutton labeled "Exit" which
  3728.              would be 100 units wide and 30 high.  It's origin would
  3729.              be 5 units from the left and 40 units from the top of
  3730.              the Dialog Box.  It would have identifier number 100.
  3731.              We could not use this identifier for any other Control.
  3732.  
  3733.           Controls defined in BasicBasic are:
  3734.  
  3735.                  pushbutton
  3736.                  radiobutton
  3737.                  checkbox
  3738.                  edit
  3739.                  ltext
  3740.                  group
  3741.                  ok
  3742.                  filename
  3743.                  filelist
  3744.                  filepath
  3745.  
  3746.  
  3747.           All Controls have the general format shown above for
  3748.           Pushbutton.  What follows is a description of each Control
  3749.           recognized and any special format needed to define it or
  3750.           any special way it is used.
  3751.  
  3752.           PUSHBUTTON:  Pushbuttons cause the Dialog to end.  You can
  3753.           use the DIALOG$ function to determine which pushbutton
  3754.           ended the Dialog.
  3755.  
  3756.           RADIOBUTTON: Radio buttons can be used to allow the user
  3757.                                       56
  3758.  
  3759.  
  3760.  
  3761.  
  3762.  
  3763.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.           to supply additional information.  Radiobuttons DO NOT end
  3770.           the dialog.  You can optionally set the state of a
  3771.           pushbutton when defining it:
  3772.  
  3773.                 a$(1)="RADIOBUTTON,10,10,200,30,101,YES,1"
  3774.  
  3775.              This defines a radio button at 10,10 with width 200 and
  3776.              height 30.  The control identifier is 101 and the text
  3777.              YES will be display in it.  The '1' at the end
  3778.              specifies that this button will be enabled at start.
  3779.              Omitting this number or making it '0' means the button
  3780.              is NOT enabled at start.
  3781.  
  3782.              Radio Buttons may be grouped.  In a group if one button
  3783.              is pushed all the rest are cleared.  BasicBasic
  3784.              considers Radiobuttons with consecutive id's to be part
  3785.              of a group.  The following three buttons are part of a
  3786.              group:
  3787.  
  3788.                 a$(1)="RADIOBUTTON,10,10,200,30,101,BLACK"
  3789.                 a$(2)="RADIOBUTTON,10,50,200,30,102,RED,1"
  3790.                 a$(3)="RADIOBUTTON,10,90,200,30,103,WHITE"
  3791.  
  3792.              In this group RED will be enabled at start.
  3793.  
  3794.           CHECKBOX: Check buttons are similar to Radio buttons
  3795.           except they may not be grouped and hence do not clear any
  3796.           other Checkbox when one is checked.
  3797.  
  3798.           EDIT: Edit fields allow the operator to input text.  The
  3799.           text string at the end of the definition is the default
  3800.           text entry.  To provide a label for an EDIT control you
  3801.           will have to use LTEXT defined later.
  3802.  
  3803.           LTEXT: Ltext displays static text left justified.  You may
  3804.           display text anywhere in the Dialog box and this is
  3805.           particulary used for providing a header for an Edit
  3806.           Control.  Here is an example:
  3807.  
  3808.              A$(1)="LTEXT,10,10,200,30,103,Enter Name"
  3809.  
  3810.           GROUP:  Group draws a box on the screen and provides a
  3811.           label at the top of the box.  It is particularly useful
  3812.           for providing a visual indicator of Radio button groups.
  3813.           An example to draw a box at 10,10 100 units wide by 50
  3814.           high would be:
  3815.  
  3816.              A$(1)="GROUP,10,10,100,50,101,Colors"
  3817.  
  3818.           OK: OK is a special pushbutton.  It is defined the same
  3819.           way as any pushbutton.  If you have an OK control defined
  3820.           then the dialog will end if the user presses 'Enter' at
  3821.           any Edit field.  It is required when using the following
  3822.           file controls.  Only one OK control may be in a Dialog.
  3823.                                       57
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3830.  
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.           FILENAME:  This is a special Edit field used for getting a
  3837.           file name.  It is used in conjuction with OK, FILELIST,
  3838.           and FILEPATH controls.  The text element is the default
  3839.           file name.  The presence of a FILENAME control means that
  3840.           the Dialog box will not terminate until a name of an
  3841.           existing file is entered or a pushbutton other than the OK
  3842.           control is pushed.
  3843.  
  3844.              a$(1)="filename,10,10,200,30,101,CONFIG.SYS"
  3845.  
  3846.           FILENAMEW: This functions just like FILENAME, except if
  3847.           this control is used no check to see if the file exists is
  3848.           made before the Dialog terminates.  Only one
  3849.           FILENAME/FILENAMEW may be used in a Dialog.
  3850.  
  3851.  
  3852.           FILELIST:  This defines a box which will contain a display
  3853.           of files.  It is used in conjuction with OK, FILENAME, and
  3854.           FILEPATH controls.  The text element contains the DOS file
  3855.           search string.  The user may use the mouse to select files
  3856.           which will automatically be placed in the FILENAME (or
  3857.           FILENAMEW) control.  Only one FILELIST may be in a Dialog.
  3858.  
  3859.              a$(1)="filelist,10,10,200,200,101,*.bmp"
  3860.  
  3861.           FILEPATH:  This defines a string which will DISPLAY the
  3862.           current directory path being accessed.  It is used in
  3863.           conjuction with OK, FILENAME, and FILELIST.  The text
  3864.           element is the default path.  Only one FILEPATH may be in
  3865.           a Dialog.
  3866.  
  3867.              a$(1)="filepath,10,10,200,30,101,c:\windows"
  3868.  
  3869.  
  3870.           COLOR: This can be used to change the default dialog
  3871.           colors in DOS only!  The order of the colors is:  dialog
  3872.           background color, dialog foreground color, dialog selected
  3873.           color, button foreground color, radio button background
  3874.           color, push button background color.
  3875.  
  3876.              a$(1)="COLOR,0,1,4,5,6,7"
  3877.  
  3878.  
  3879.  
  3880.           The following example shows a dialog box:
  3881.  
  3882.              rem go into graphics mode
  3883.              screen 2
  3884.  
  3885.              dim control$(100)
  3886.  
  3887.              rem define controls
  3888.              control$(0)="ltext,10,10,100,30,100,Name:"
  3889.                                       58
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3896.  
  3897.  
  3898.  
  3899.  
  3900.  
  3901.              control$(1)="edit,110,10,200,30,101,"
  3902.              control$(2)="ltext,10,50,100,30,102,Address:"
  3903.              control$(3)="edit,110,50,200,30,103,"
  3904.              control$(4)="pushbutton,10,110,50,30,104,Done"
  3905.              control$(5)="radiobutton,130,110,110,25,105,Type A,1"
  3906.              control$(6)="radiobutton,130,134,110,25,106,Type B"
  3907.              control$(7)="group,118,80,180,90,107,Personality Type"
  3908.              control$(8)="checkbox,10,174,100,30,108,Widgets"
  3909.              control$(9)="checkbox,130,174,100,30,109,Gadgets,1"
  3910.              control$(10)="checkbox,250,174,100,30,110,Doodads"
  3911.  
  3912.              rem call dialog
  3913.              dialog control$(0),11,10,10,350,210,"Client Info"
  3914.  
  3915.              rem display results of dialog
  3916.              print "name=";dialog$(101)
  3917.              print "address=";dialog$(103)
  3918.              print "done=";dialog$(104)
  3919.              print "radio 1=";dialog$(105)
  3920.              print "radio 2=";dialog$(106)
  3921.              print "widgets=";dialog$(108)
  3922.              print "gadgets=";dialog$(109)
  3923.              print "doodads=";dialog$(110)
  3924.  
  3925.              input z
  3926.  
  3927.  
  3928.  
  3929.  
  3930.  
  3931.  
  3932.  
  3933.  
  3934.  
  3935.  
  3936.  
  3937.  
  3938.  
  3939.  
  3940.  
  3941.  
  3942.  
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.  
  3952.  
  3953.  
  3954.  
  3955.                                       59
  3956.  
  3957.  
  3958.  
  3959.  
  3960.  
  3961.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.           PROGRAM ICON
  3969.           -------------------------------------------------------
  3970.  
  3971.           Windows programs may have an 'icon' associated with them.
  3972.           An icon is the little picture which is placed in a folder
  3973.           when a program is installed or which is displayed when a
  3974.           program is minimized.  BasicBasic programs have a default
  3975.           icon; but you may want to make your own.
  3976.  
  3977.           Icons are ignored in DOS.
  3978.  
  3979.           To add an icon to a program you must do two things:
  3980.  
  3981.             1. Create an icon.
  3982.  
  3983.                In Windows you can do this by selecting 'Icon Editor'
  3984.                from the Transfer menu.
  3985.  
  3986.                In DOS you can execute the icon editor by running the
  3987.                program BBICON.EXE. The editor requires a mouse.
  3988.  
  3989.             2. Tell the compiler to use your icon with the $ICON
  3990.                metacommand:
  3991.  
  3992.                      REM #ICON: 'MYFILE.ICO'
  3993.  
  3994.           BasicBasic contains a simple icon editor which allows you
  3995.           to create icons for use in your program.  The icons
  3996.           created will always be 32 by 32 pixels in size and have up
  3997.           to 16 colors.
  3998.  
  3999.           When first started the icon editor displays a white icon.
  4000.           You change the color of a pixel by putting the pointer
  4001.           over it and pressing the mouse button.  You select the
  4002.           color to use from the palette at the right of the screen.
  4003.           Pixel by pixel you create your icon until you are ready to
  4004.           save it using the File menu.  It is standard practice
  4005.           (though not required) to give an icon file the extension
  4006.           .ICO.
  4007.  
  4008.           Advanced Users:
  4009.  
  4010.           A Windows icon actually contains two 32 by 32 pixel
  4011.           bitmaps.  The primary bitmap tells the colors of the
  4012.           pixels.  This bitmap is the default bitmap displayed by
  4013.           the BasicBasic icon editor.
  4014.  
  4015.           The second bitmap tells Windows which pixels in the bitmap
  4016.           are transparent and which ones are opaque.  The default
  4017.           for a BasicBasic icon is all opaque.  You can access this
  4018.           second bitmap from the View menu.  The second bitmap is
  4019.           called the 'Mask' bitmap.  When viewing the mask bitmap
  4020.           each pixel may be either black (opaque) or white
  4021.                                       60
  4022.  
  4023.  
  4024.  
  4025.  
  4026.  
  4027.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4028.  
  4029.  
  4030.  
  4031.  
  4032.  
  4033.           (transparent).
  4034.  
  4035.           Keep in mind that if you make a transparent mask that the
  4036.           background will show through your icon.  If there is a
  4037.           color other than black in the corresponding color bitmap
  4038.           pixel, the color actually displayed will be a blend of the
  4039.           background color and the color you selected.
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054.  
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.  
  4064.  
  4065.  
  4066.  
  4067.  
  4068.  
  4069.  
  4070.  
  4071.  
  4072.  
  4073.  
  4074.  
  4075.  
  4076.  
  4077.  
  4078.  
  4079.  
  4080.  
  4081.  
  4082.  
  4083.  
  4084.  
  4085.  
  4086.  
  4087.                                       61
  4088.  
  4089.  
  4090.  
  4091.  
  4092.  
  4093.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4094.  
  4095.  
  4096.  
  4097.  
  4098.  
  4099.  
  4100.           COMMUNICATIONS PROGRAMMING
  4101.           -------------------------------------------------------
  4102.           
  4103.           Here is a brief example of using a communications port.
  4104.  
  4105.             rem
  4106.             rem open communications port
  4107.             rem
  4108.             OPEN "COM1: 2400,N,8" FOR RANDOM AS #1 LEN=2048
  4109.  
  4110.           100
  4111.  
  4112.             rem
  4113.             rem get input from communications port
  4114.             rem
  4115.             t = LOC(1)
  4116.             IF t > 0 THEN
  4117.               a$=input$(t,1)
  4118.               if len(a$)>0 then
  4119.                 rem come here to display received characters
  4120.                 PRINT a$;
  4121.  
  4122.               ELSE
  4123.                 rem come here if some kind of comm error that kept
  4124.                 rem us from getting the waiting character.
  4125.  
  4126.               end if
  4127.  
  4128.             END IF
  4129.  
  4130.             rem
  4131.             rem get input from keyboard
  4132.             rem
  4133.  
  4134.             b$ = INKEY$
  4135.  
  4136.             IF b$ <> "" THEN
  4137.  
  4138.                 PRINT #1, b$;
  4139.  
  4140.             END IF
  4141.  
  4142.             GOTO 100
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.                                       62
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166.  
  4167.           WINDOWS AND GRAPHICS
  4168.           -------------------------------------------------------
  4169.           
  4170.           In general programming graphics under Windows is the same
  4171.           as programming graphics under DOS.  However, because
  4172.           Windows mediates hardware access among different programs
  4173.           there are a few differences.
  4174.  
  4175.           COLORS
  4176.  
  4177.           Under DOS or Windows, BasicBasic provides a palette of 16
  4178.           colors.  Under DOS this palette is the hardware palette
  4179.           and you have full control to change them (depending on
  4180.           mode using either the COLOR or PALETTE statements).  Under
  4181.           Windows the palette is a 'logical' palette and only
  4182.           Windows controls where in the physical palette the logical
  4183.           palette entries are placed.  In addition, if you are
  4184.           running under standard VGA or less, Windows will not let
  4185.           you change the colors in the palette.  You are restricted
  4186.           to the 16 colors Windows defines.
  4187.  
  4188.           BasicBasic defaults to using the system palette.  This is
  4189.           a palette of 16 colors which Windows never changes.  This
  4190.           also means that your program cannot change them with the
  4191.           PALETTE or COLOR(in mode 8) commands.  If you want to
  4192.           change the standard colors you will have to use a
  4193.           'logical' palette.  In BasicBasic you do this using the
  4194.           SCREEN command.
  4195.  
  4196.           Using a logical palette has benefits and drawbacks.  As
  4197.           mentioned you can change the colors display.  This may be
  4198.           of use in animation.  However, there are serious
  4199.           drawbacks.  The PUT with any option except PSET will not
  4200.           work correctly.  This is explained below.  Also, when your
  4201.           program is not the 'active' window, Windows may remove
  4202.           your colors from the hardware palette resulting in some
  4203.           strange looking displays.  In addition, if this happens,
  4204.           the PAINT command may have completely unforseen
  4205.           consequences.  You can use the SYSTEM function to
  4206.           determine if your program is the active program.  When
  4207.           your program is active your colors will all be available
  4208.           for your use.
  4209.  
  4210.           Logical palettes do not support using the PUT graphics
  4211.           statement with the XOR, OR, or AND options.  If you use
  4212.           XOR the colors will not be as expected (though, as usual
  4213.           if you do 2 PUT statements with XOR the background will be
  4214.           restored).  The reason for this is that Windows may 'map'
  4215.           the logical palette entries to the physical palette anyway
  4216.           it likes.  If you must use XOR, use the default BasicBasic
  4217.           palette which is the system palette.
  4218.  
  4219.                                       63
  4220.  
  4221.  
  4222.  
  4223.  
  4224.  
  4225.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.  
  4232.           SCREEN MODES
  4233.  
  4234.           Under Windows you have access to the same screen modes as
  4235.           under DOS.  The COLOR and PALETTE statements work the same
  4236.           under DOS as under Windows.  In addition under Windows you
  4237.           have access to an additional screen mode: mode 1000.  In
  4238.           mode 1000 you are able to create new fonts.  Mode 1000
  4239.           gives you the highest possible graphics resolution.  Also
  4240.           the COLOR command is somewhat more flexible than under DOS
  4241.           screen modes.  The LOCATE and SCROLLAREA statements and
  4242.           functions POS, CSRLIN work differently in this mode.
  4243.  
  4244.           Also under Windows you have the option of specifying the
  4245.           size of the logical palette your program will have access
  4246.           to.  This is limited by the physical palette supported by
  4247.           your hardware.  Standard VGA supports only 16 palette
  4248.           entries.  Super VGA may (depending on memory) support up
  4249.           to 256 palette entries.  You could select 256 palette
  4250.           entires by using this command:
  4251.  
  4252.                       SCREEN 1000,256
  4253.  
  4254.           Windows actually only allows you to change 236 of the
  4255.           palette entries.  The other entries are defined by Windows
  4256.           as follows:
  4257.  
  4258.               0 - black          246 - cream
  4259.               1 - dark red       247 - lightish gray
  4260.               2 - dark green     248 - medium gray
  4261.               3 - dark yellow    249 - red
  4262.               4 - dark blue      250 - green
  4263.               5 - dark magenta   251 - yellow
  4264.               6 - dark cyan      252 - blue
  4265.               7 - light gray     253 - magenta
  4266.               8 - money green    254 - cyan
  4267.               9 - sky blue       255 - white
  4268.  
  4269.  
  4270.           NAKED WINDOWS
  4271.  
  4272.           When running under Windows you do not have exclusive
  4273.           access to the screen.  At any time your window may be
  4274.           hidden by another window appearing on the screen.  At some
  4275.           future time the operator may make your window reappear
  4276.           with the click of the mouse button.  When your window has
  4277.           been hidden and is then called to the front, Windows DOES
  4278.           NOT handle putting the contents of the window back in!
  4279.           All windows privides is the outline of the window.  This
  4280.           'naked' window must be filled in by either BasicBasic or
  4281.           your program.
  4282.  
  4283.           By default BasicBasic handles all window 'repainting'.
  4284.           BasicBasic remembers everything that your program sends to
  4285.                                       64
  4286.  
  4287.  
  4288.  
  4289.  
  4290.  
  4291.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4292.  
  4293.  
  4294.  
  4295.  
  4296.  
  4297.           the screen and when necessary repaints the window with
  4298.           this information.  In text mode (screen mode 0) a small
  4299.           buffer remembers each character on the screen.  In
  4300.           graphics mode BasicBasic maintains a larger buffer
  4301.           containing a duplicate of each pixel on the screen.  This
  4302.           buffer can take up quite a bit of space.(On a 640 x 200 16
  4303.           color display this requires 128,000 bytes).  Ordinarily
  4304.           you don't need to worry about this.  If your program isn't
  4305.           going to be in memory very long, or has a small window,
  4306.           who cares?
  4307.  
  4308.           If you are short of memory or have a very large window
  4309.           which is going to stay around all day you may not like
  4310.           this arrangement.  In this case you should use the ON
  4311.           PAINT statement.  This statement tells BasicBasic to NOT
  4312.           keep a copy of the display; that you are going to handle
  4313.           repainting when necessary.  Here is an example:
  4314.  
  4315.                  ON PAINT GOSUB 1000
  4316.                  SCREEN 8
  4317.                  sc=8
  4318.                  gosub drawmyscreen
  4319.           50
  4320.                  if inkey$="" then goto 50
  4321.                  STOP
  4322.  
  4323.           1000
  4324.                  gosub drawmyscreen
  4325.                  RETURN
  4326.  
  4327.           drawmyscreen:
  4328.                  if sc=0 then return
  4329.                  locate 1,1
  4330.                  print "Now is the time to draw circles..."
  4331.                  circle (50,50),25,4
  4332.                  circle (75,75),50,1
  4333.                  circle (400,50),40,2
  4334.                  circle (500,100),75,3
  4335.                  return
  4336.  
  4337.           Here are some rules to remember about using the ON PAINT
  4338.           statement:
  4339.  
  4340.             - Use it before your SCREEN statement.  BasicBasic
  4341.               creates the screen duplicate during the SCREEN
  4342.               statement. It will, if necessary, erase it during the
  4343.               ON PAINT statement, but why go to the bother.
  4344.  
  4345.             - NEVER use any input commands, file commands, com
  4346.               commands, etc in you ON PAINT handler.
  4347.  
  4348.             - Don't change variables in your ON PAINT handler that
  4349.               are used elsewhere in your program.  Remember that
  4350.               Windows ALWAYS calls your ON PAINT handler at the
  4351.                                       65
  4352.  
  4353.  
  4354.  
  4355.  
  4356.  
  4357.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4358.  
  4359.  
  4360.  
  4361.  
  4362.  
  4363.               WORST POSSIBLE TIME!
  4364.  
  4365.             - It is wise not to use the INPUT command in a program
  4366.               that has it's own ON PAINT handler.  BasicBasic will
  4367.               not rewrite what has been input so far.
  4368.  
  4369.             - Your ON PAINT handler may be called IMMEDIATELY after
  4370.               you issue the ON PAINT command.  Make sure you are
  4371.               ready.  Note the line IF SC=0 THEN RETURN in our
  4372.               example.  Try running this program without this line.
  4373.  
  4374.  
  4375.  
  4376.  
  4377.  
  4378.  
  4379.  
  4380.  
  4381.  
  4382.  
  4383.  
  4384.  
  4385.  
  4386.  
  4387.  
  4388.  
  4389.  
  4390.  
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.  
  4400.  
  4401.  
  4402.  
  4403.  
  4404.  
  4405.  
  4406.  
  4407.  
  4408.  
  4409.  
  4410.  
  4411.  
  4412.  
  4413.  
  4414.  
  4415.  
  4416.  
  4417.                                       66
  4418.  
  4419.  
  4420.  
  4421.  
  4422.  
  4423.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4424.  
  4425.  
  4426.  
  4427.  
  4428.  
  4429.  
  4430.           BITMAPS
  4431.           -------------------------------------------------------
  4432.  
  4433.           BasicBasic supports the loading and storing of device
  4434.           independent bitmap files as defined in Windows 3.
  4435.           BasicBasic supports bitmaps under EITHER DOS or Windows.
  4436.           You must be in graphics mode to load or store bitmaps.
  4437.           Windows (and SOME Windows applications) support a
  4438.           compressed bitmap format to save space.  BasicBasic also
  4439.           supports loading and store compressed bitmap files.
  4440.  
  4441.           A simple program to load a bitmap could be as follows (the
  4442.           file CARS.BMP is a standard bitmap file supplied with
  4443.           Windows).
  4444.  
  4445.                 screen 8
  4446.                 x=100
  4447.                 y=100
  4448.                 ffname$="c:\windows\cars.bmp"
  4449.                 loadbitmap ffname$,0,x,y,0,0,16,16,0,0,0
  4450.                 input z
  4451.  
  4452.           This example loads the upper left most 16 by 16 pixels of
  4453.           the bitmap and puts in on the screen starting at 100,100.
  4454.           If we had wanted to double the size of the graphic in the
  4455.           x direction we could have done the following load:
  4456.  
  4457.                 loadbitmap ffname$,0,x,y,0,0,16,16,0,2,0
  4458.  
  4459.           If we had wanted to skip every other line of pixels we
  4460.           could have done the following load:
  4461.  
  4462.                 loadbitmap ffname$,0,x,y,0,0,16,16,0,0,-2
  4463.  
  4464.           This would have loaded 16 lines of the bitmap, but only
  4465.           displayed every other one.
  4466.  
  4467.           BITMAPS AND COLORS
  4468.  
  4469.           With each device independent bitmap is stored information
  4470.           about the colors defined for that bitmap.  There may be
  4471.           information about 2 colors, 16 colors, 256 colors or
  4472.           16,777,216 colors.  BasicBasic supports the first 3 types
  4473.           of bitmaps.  The colors in the bitmap may or may not be
  4474.           the same as those defined in your current palette.  When
  4475.           you load a bitmap you might want to make sure that your
  4476.           palette has the colors necessary to correctly display the
  4477.           bitmap.  Alternately you can tell BasicBasic to attempt to
  4478.           match bitmap colors to your currently defined palette
  4479.           colors.  This is the easiest thing to do, though, it may
  4480.           not result in the best rendering of the graphic.
  4481.  
  4482.           In the examples we have used so far we have let BasicBasic
  4483.                                       67
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.           match colors for us.  We do this by setting the ninth
  4496.           parameter to 0.
  4497.  
  4498.                 cv=0
  4499.                 loadbitmap ffname$,0,x,y,0,0,16,16,cv,0,0
  4500.  
  4501.           We could also set cv to 1; in which case, BasicBasic would
  4502.           make no color correction and the existing palette colors
  4503.           would be used to display the bitmap.
  4504.  
  4505.           For maximum color compatibility you will want to load the
  4506.           colors from the bitmap and assign them you your logical
  4507.           palette.  The first step in this process is to determine
  4508.           how many colors the bitmap has defined.  You do this using
  4509.           the BITMAPH function.
  4510.  
  4511.             e.g.
  4512.                    dim a&(256)
  4513.                    a=bitmaph("C:\windows\cars.bmp",a&(0))
  4514.                    numcolorbits=a&(4)
  4515.                    if numcolorbits=2
  4516.                      print "2 colors defined"
  4517.                    elseif numcolorbits=4
  4518.                      print "16 colors defined"
  4519.                    elseif numcolorbits=8
  4520.                      print "256 colors defined"
  4521.                    else
  4522.                      print "colors explicitly defined for each bit"
  4523.                    end if
  4524.  
  4525.           You can determine how many colors can be displayed on your
  4526.           screen by using the SYSTEM function
  4527.  
  4528.                    maxcolors=system(5)
  4529.  
  4530.           If the bitmap has more colors than your screen can display
  4531.           then the best course to follow is to allow BasicBasic to
  4532.           convert colors for you.  If, on the other, hand you have
  4533.           enough room in your palette to display all the colors
  4534.           defined in the bitmap then you can load them using the
  4535.           BITMAPC function and assign them using the PALETTE
  4536.           command.
  4537.  
  4538.  
  4539.                  screen 8
  4540.  
  4541.                  dim a&(256)
  4542.  
  4543.                  ffname$="c:\windows\cars.bmp"
  4544.  
  4545.                  a=bitmaph(ffname$,a&(0))
  4546.                  x=0
  4547.                  y=0
  4548.                  pxsize=a&(1)
  4549.                                       68
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4556.  
  4557.  
  4558.  
  4559.  
  4560.  
  4561.                  pysize=a&(2)
  4562.                  colorbits=a&(4)
  4563.                  if colorbits=2
  4564.                     colors=2
  4565.                  elseif colorbits=4
  4566.                     colors=16
  4567.                  elseif colorbits=8
  4568.                     colors=256
  4569.                  else
  4570.                     print "bitmap not supported.."
  4571.                     stop
  4572.                  end if
  4573.                  maxcolors=system(5)
  4574.  
  4575.                  if (colors<=maxcolors)
  4576.                    a=bitmapc(ffname$,a&(0))
  4577.                    if colors>236 then
  4578.                     for i=10 to 246
  4579.                       palette i,a&(i)
  4580.                     next i
  4581.                    else
  4582.                     for i=0 to colors
  4583.                      palette i,a&(i)
  4584.                     next i
  4585.                    end if
  4586.                    cv=0
  4587.                  else
  4588.                    cv=1
  4589.                  end if
  4590.  
  4591.                  x=100
  4592.                  y=100
  4593.                  ymult=2
  4594.                  loadbitmap ffname$,0,x,y,0,0,16,16,cv,0,0
  4595.  
  4596.                  input z
  4597.  
  4598.           Note to Windows Users:  With a 256 color palette, Windows
  4599.           only allows 236 to be changed by the user.  The first 10
  4600.           and and last 10 are fixed.  This is why we only assign 236
  4601.           colors in the example above.
  4602.  
  4603.           STORING BITMAPS
  4604.  
  4605.           If you have a graphic displayed on the screen you can save
  4606.           it to a bitmap file using the STOREBITMAP command.  It
  4607.           will be saved in the same color resolution as your screen.
  4608.           You can optionally tell BasicBasic to store the file in
  4609.           compressed format to save space.  Note, however, that a
  4610.           complex picture with much fine detail may compress to a
  4611.           LARGER file than the original!  Also it will take longer
  4612.           to store a bitmap using compression, than without.
  4613.  
  4614.  
  4615.                                       69
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4622.  
  4623.  
  4624.  
  4625.  
  4626.  
  4627.                screen 8
  4628.                line (0,0)-(100,100),1
  4629.                x=0
  4630.                y=0
  4631.                pxsize=100
  4632.                pysize=100
  4633.                cp=1          : rem compress it
  4634.                storebitmap 0,ffname$,x,y,pxsize,pysize,cp,0
  4635.  
  4636.                input z
  4637.  
  4638.  
  4639.  
  4640.  
  4641.  
  4642.  
  4643.  
  4644.  
  4645.  
  4646.  
  4647.  
  4648.  
  4649.  
  4650.  
  4651.  
  4652.  
  4653.  
  4654.  
  4655.  
  4656.  
  4657.  
  4658.  
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670.  
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.  
  4680.  
  4681.                                       70
  4682.  
  4683.  
  4684.  
  4685.  
  4686.  
  4687.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4688.  
  4689.  
  4690.  
  4691.  
  4692.  
  4693.  
  4694.           WINDOWS AND FONTS
  4695.           -------------------------------------------------------
  4696.  
  4697.           To create fonts in Windows you must have selected Screen
  4698.           mode 1000.  In this mode some statements and commands work
  4699.           differently.  LOCATE x,y now position by dot position,
  4700.           rather than character position.  POS and CSRLIN return the
  4701.           corresponding pixel position rather than character
  4702.           position.
  4703.  
  4704.           See the sample program SAMPLEF1.BAS for some examples of
  4705.           font creation.
  4706.  
  4707.           If you are going to create fonts you should NOT use the
  4708.           WINDOWS SIZE metacommand.  Instead use POSITION as
  4709.           necessary to adjust the size ofyour window.
  4710.  
  4711.           You may create up to 10 fonts, number 1 through 10.  Font
  4712.           number 0 is reserved for BasicBasic's default font.  You
  4713.           create a font using the CREATEFONT command.  Once you have
  4714.           created a font you must select it with the SELECTFONT
  4715.           command.  You may get information on the currently
  4716.           selected font using the FONT and FONT$ functions.
  4717.  
  4718.           The CREATEFONT statement has a lot of arguments.  However,
  4719.           it is not as complex to use as it looks.  Usually you are
  4720.           only interested in specifying one or two things about the
  4721.           font; such as height.  In this case you can set all other
  4722.           arguments to 0.  Below is a complete description of the
  4723.           CREATEFONT command.
  4724.  
  4725.           Argument P10 must be set to 3 (OEM Font) to use most of
  4726.           the built in Windows fonts!
  4727.  
  4728.           CREATEFONT
  4729.           p1,p2,p3,p4,p5,p6,p7,p8.p9.p10,p11.p12,p13,p14,p15$
  4730.  
  4731.             p1 = Font number to be created.
  4732.                  A number from 1 to 10.
  4733.             p2 = Font height (in pixels).
  4734.                  Desired height of characters.  This specifies the
  4735.                  line spacing.
  4736.             p3 = Font width
  4737.                  Desired width of characters.  Usually set to 0
  4738.             p4 = escapement
  4739.                  Which way the text goes.
  4740.                  0 - right
  4741.                  900 - up
  4742.                  1800 - right to left
  4743.                  2700 - down
  4744.             p5 = orientation
  4745.                  0 = Normal
  4746.                  900 = tipped 90 degrees to the left
  4747.                                       71
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4754.  
  4755.  
  4756.  
  4757.  
  4758.  
  4759.                  1800 = upside down
  4760.                  2700 = tipped 90 degrees to the right
  4761.             p6 = weight
  4762.                    0 = don't care
  4763.                  100 = thin
  4764.                  200 = extralight
  4765.                  300 = light
  4766.                  400 = normal
  4767.                  500 = medium
  4768.                  600 = semibold
  4769.                  700 = boldface
  4770.                  800 = extra bold
  4771.                  900 = heavy
  4772.             p7 = italic
  4773.                  When nonzero this specifies italics
  4774.             p8 = underline
  4775.                  When nonzero this specifies underlining
  4776.             p9 = strikeout
  4777.             p10 = character set
  4778.                   0 = ANSI character set
  4779.                   1 = SYMBOL character set
  4780.                   2 = Japanese Kanji
  4781.                   3 = OEM character set
  4782.           ->          Most Windows fonts are OEM fonts (e.g. script)
  4783.             p11 = output precision
  4784.                   Specifies how Windows should attempt to match
  4785.                   desired font sizes and characters with actual
  4786.                   fonts.  Not currently defined.  Make 0
  4787.             p12 = clip precision
  4788.                   Not currently defined.  Make 0.
  4789.             p13 = quality
  4790.                   Instruction to Windows on how to match fonts.
  4791.                   0 - Default Quality.  Don't make bigger that
  4792.                       desired.
  4793.                   1 - Draft Quality.
  4794.                   2 - Proof Quality.  This is the best quality,
  4795.                       but size may be smaller than desired.
  4796.             p14 = pitch and family
  4797.                   The two low order bits specify the pitch of the
  4798.                   font.
  4799.                     0 = Default
  4800.                     1 = Fixed pitch
  4801.                     2 = Variable
  4802.                   The four high order bits specify the font family.
  4803.                     0 = don't care
  4804.                     &H10 = Roman
  4805.                     &H20 = Swiss
  4806.                     &H30 = Modern
  4807.                     &H40 = Script
  4808.                     &H50 = Decorative
  4809.             p15$ = "face name"
  4810.                   This is the name of the typeface.  You do not need
  4811.                   to specify this.  If you do it takes priority over
  4812.                   any other options you specify (such as height).
  4813.                                       72
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.                   Examples of face names are COURIER, TMS RMN, etc.
  4826.  
  4827.           Here is an example of a CREATEFONT command which creates a
  4828.           font 60 pixels high.  All other parameters are left at
  4829.           default.
  4830.  
  4831.               CREATEFONT 1,60,0,0,0,0,0,0,0,0,0,0,0,0,""
  4832.  
  4833.           To print with this font you would first have to select it.
  4834.  
  4835.               SELECTFONT 1
  4836.  
  4837.  
  4838.           When you create a font Windows tries to match the
  4839.           characteristics you specify in the CREATEFONT command.  It
  4840.           may not be able to in all cases.  Perhaps you specify an
  4841.           incompatible height and width.  In these cases Windows
  4842.           gets as close as it can.  If some parameter is important
  4843.           to your application you should check to make sure the font
  4844.           you created meets your requirements.  Using the FONT
  4845.           function you can examine the selected font.
  4846.  
  4847.           FONT(n)
  4848.  
  4849.               n    returns
  4850.              ---   ----------------------------------------------
  4851.               1    character height
  4852.               2    Ascent
  4853.               3    Descent
  4854.               4    Internal Leading
  4855.               5    Extern Leading
  4856.               6    Average Character Width
  4857.               7    Maximum Character Width
  4858.               8    Weight
  4859.               9    Italic
  4860.               10   Underline
  4861.               11   Strikeout
  4862.               12   First character
  4863.               13   Last character
  4864.               14   Default character
  4865.               15   Break character
  4866.               16   Pitch and Family
  4867.               17   Character set
  4868.               18   Overhang
  4869.               19   Digitized Aspect x
  4870.               20   Digitized Aspect y
  4871.  
  4872.           There is another function which will return the face name.
  4873.  
  4874.           FONT$(n)
  4875.  
  4876.               n    returns
  4877.              ---   ----------------------------------------
  4878.               1    face name
  4879.                                       73
  4880.  
  4881.  
  4882.  
  4883.  
  4884.  
  4885.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4886.  
  4887.  
  4888.  
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894.           If you need additional information on fonts (or Windows
  4895.           programming in general), a useful reference is 'Windows
  4896.           API Bible' by James L. Conger.
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903.  
  4904.  
  4905.  
  4906.  
  4907.  
  4908.  
  4909.  
  4910.  
  4911.  
  4912.  
  4913.  
  4914.  
  4915.  
  4916.  
  4917.  
  4918.  
  4919.  
  4920.  
  4921.  
  4922.  
  4923.  
  4924.  
  4925.  
  4926.  
  4927.  
  4928.  
  4929.  
  4930.  
  4931.  
  4932.  
  4933.  
  4934.  
  4935.  
  4936.  
  4937.  
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.                                       74
  4946.  
  4947.  
  4948.  
  4949.  
  4950.  
  4951.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.           CHAINING AND COMMON
  4960.           -------------------------------------------------------
  4961.  
  4962.           Here are examples of two programs, CHAIN1 and CHAIN2,
  4963.           which pass variables back and forth in common.
  4964.  
  4965.  
  4966.               CHAIN1
  4967.  
  4968.                   common a,b,c,d$(),c()
  4969.                   if a=0 then
  4970.                     cls
  4971.                     a=1
  4972.                     dim d$(10)
  4973.                     dim c(20)
  4974.                     d$(5)="This is d$(5)"
  4975.                   end if
  4976.                   print "press any key to go to chain 2"
  4977.                 100
  4978.                   a$=inkey$
  4979.                   if a$="" then goto 100
  4980.                   chain "chain2.exe"
  4981.  
  4982.  
  4983.               CHAIN2
  4984.  
  4985.                   common a,b,c,d$(),c()
  4986.                   b=b+1
  4987.                   print "this is chain 2"
  4988.                   print "b=";b;
  4989.                   print d$(5)
  4990.                   input z
  4991.                   chain "chain1.exe"
  4992.  
  4993.  
  4994.  
  4995.  
  4996.  
  4997.  
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006.  
  5007.  
  5008.  
  5009.  
  5010.  
  5011.                                       75
  5012.  
  5013.  
  5014.  
  5015.  
  5016.  
  5017.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5018.  
  5019.  
  5020.  
  5021.  
  5022.  
  5023.  
  5024.           BasicBasic Technical
  5025.           -------------------------------------------------------
  5026.  
  5027.           BasicBasic is intended to be a subset of Microsoft Basic.
  5028.           More statements and functions will be added with each
  5029.           release.  Depending on your religion you may or may not be
  5030.           happy to see that GOTO is supported.  BasicBasic's syntax
  5031.           is 'almost' the same as Microsoft's Basic.  Here are some
  5032.           known syntax differences:
  5033.  
  5034.                BasicBasic scans expressions from left to right the
  5035.                same as Microsoft Basic, however, BasicBasic checks
  5036.                all multiplies before divides and all minus signs
  5037.                before addition.
  5038.  
  5039.                BasicBasic does not support the underscore (_) line
  5040.                extension character.
  5041.  
  5042.           Most functions and statements have the same syntax as
  5043.           Microsoft Basic.  You should check the Statement and
  5044.           Function Reference section for details on syntax.
  5045.  
  5046.           Date types supported are integer (% suffix), long integer
  5047.           (& suffix), single precision (no suffix), and string ($
  5048.           suffix).  Double precision numbers are not supported in
  5049.           this version.
  5050.  
  5051.           BasicBasic does not support a standard array of size 10.
  5052.           Every array must be explicitly dimensioned with a DIM
  5053.           statement.
  5054.  
  5055.           CAPACITIES
  5056.  
  5057.              General limits:
  5058.  
  5059.                      Maximum number of arrays:  100
  5060.                              Total open files:  10
  5061.                            Total string space:  approx. 47000 chars.
  5062.                 Maximum character string size:  2048
  5063.                               Maximum Buttons:  40
  5064.  
  5065.              Windows only limits:
  5066.  
  5067.                                 Maximum menus:  6
  5068.                       Maximum Items in a menu:  10
  5069.                         Maximum Fonts Defined:  10
  5070.  
  5071.  
  5072.  
  5073.           RESERVED WORDS
  5074.  
  5075.           All names of statements and functions are reserved words
  5076.           and may not be used as variable names.  ERR is a special
  5077.                                       76
  5078.  
  5079.  
  5080.  
  5081.  
  5082.  
  5083.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5084.  
  5085.  
  5086.  
  5087.  
  5088.  
  5089.           case.  This is a system wide variable used to return error
  5090.           information to BasicBasic programs.  See the command
  5091.           SETERRLEVEL for more complete information.
  5092.  
  5093.  
  5094.  
  5095.  
  5096.  
  5097.  
  5098.  
  5099.  
  5100.  
  5101.  
  5102.  
  5103.  
  5104.  
  5105.  
  5106.  
  5107.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  5115.  
  5116.  
  5117.  
  5118.  
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.  
  5128.  
  5129.  
  5130.  
  5131.  
  5132.  
  5133.  
  5134.  
  5135.  
  5136.  
  5137.  
  5138.  
  5139.  
  5140.  
  5141.  
  5142.  
  5143.                                       77
  5144.  
  5145.  
  5146.  
  5147.  
  5148.  
  5149.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.           WINDOWS METACOMMANDS
  5157.           -------------------------------------------------------
  5158.  
  5159.  
  5160.           BasicBasic contains several Metacommands to set Windows
  5161.           environment parameters.  These commands have no affect on
  5162.           execution of the program.  All Windows Metacommands have
  5163.           the following format:
  5164.  
  5165.                  REM WINDOWS command
  5166.  
  5167.           REM WINDOWS NAME name
  5168.  
  5169.           The window name which the program will display can be
  5170.           supplied.  The default is the same as the file name of the
  5171.           program.
  5172.  
  5173.                    e.g.   REM WINDOWS NAME investments
  5174.  
  5175.           SAMPLE3.BAS uses the WINDOWS NAME metacommand.
  5176.  
  5177.  
  5178.           REM WINDOWS size x1,y1,x2,y2
  5179.  
  5180.           This command allows you to define a portion of the normal
  5181.           DOS screen size as the area to be displayed in the Windows
  5182.           window.  This is useful if you have a program centered in
  5183.           the standard 80x25 DOS screen, but do not use much of the
  5184.           border area.  Regular scrolling may not work in windows if
  5185.           you define the window size as less than 80x25.  X1 is the
  5186.           left column, y1 is the top row, x2 is the right column,
  5187.           and y2 is the bottom row.  e.g.  Do NOT use this command
  5188.           if your are using the CREATEFONT command.
  5189.  
  5190.                    e.g.       REM WINDOWS SIZE 10,10,70,15
  5191.  
  5192.           SAMPLE2.BAS uses the WINDOWS SIZE metacommand.
  5193.  
  5194.  
  5195.  
  5196.  
  5197.  
  5198.  
  5199.  
  5200.  
  5201.  
  5202.  
  5203.  
  5204.  
  5205.  
  5206.  
  5207.  
  5208.  
  5209.                                       78
  5210.  
  5211.  
  5212.  
  5213.  
  5214.  
  5215.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5216.  
  5217.  
  5218.  
  5219.  
  5220.  
  5221.  
  5222.           METACOMMANDS
  5223.           -------------------------------------------------------
  5224.  
  5225.           metacommands are preceded by REM and a dollar sign.
  5226.  
  5227.  
  5228.           INCLUDE: 'filename'
  5229.  
  5230.             This metacommand allows you to include source from
  5231.             another file in the currently compiling file.  files may
  5232.             be nexted up to 10 levels deep.  File name MUST be
  5233.             enclosed in single quotes as shown.
  5234.  
  5235.               e.g.  REM $INCLUDE: 'moretext.asc'
  5236.  
  5237.  
  5238.           ICON: 'iconfilename'
  5239.  
  5240.             This metacommand allows you in specify a special ICON
  5241.             which will be attached to your application.  This icon
  5242.             will be used in Windows when your application is
  5243.             installed.
  5244.  
  5245.               e.g.  REM $ICON: 'SAMPLEW3.ICO'
  5246.  
  5247.             SAMPLEW3.BAS use the $ICON metacommand.
  5248.  
  5249.  
  5250.  
  5251.  
  5252.  
  5253.  
  5254.  
  5255.  
  5256.  
  5257.  
  5258.  
  5259.  
  5260.  
  5261.  
  5262.  
  5263.  
  5264.  
  5265.  
  5266.  
  5267.  
  5268.  
  5269.  
  5270.  
  5271.  
  5272.  
  5273.  
  5274.  
  5275.                                       79
  5276.  
  5277.  
  5278.  
  5279.  
  5280.  
  5281.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5282.  
  5283.  
  5284.  
  5285.  
  5286.  
  5287.           SEPERATE COMPILATION
  5288.           -------------------------------------------------------
  5289.  
  5290.           You may decide to compile your program outside the
  5291.           BasicBasic program development system environment.  Here
  5292.           are instructions for doing this.
  5293.  
  5294.  
  5295.  
  5296.           DOS
  5297.  
  5298.           To compile a program under DOS type BB.  When requested
  5299.           enter the file name you want to compile.  If no extension
  5300.           is given the compiler will assume .BAS.  You can also
  5301.           enter the file name you want to compile as part of the
  5302.           start command.
  5303.  
  5304.                 e.g.   BB SAMPLE1.BAS.
  5305.  
  5306.           The executable file created will have the same name as the
  5307.           source file.
  5308.  
  5309.           You may also tell BasicBasic to create a file with a list
  5310.           of runtime addresses.  This can be useful for debugging
  5311.           since an error during runtime will return a runtime
  5312.           address followed by an error number.  You do this by
  5313.           putting a /D on the command line.
  5314.  
  5315.                e.g.    BB SAMPLE1.BAS /D
  5316.  
  5317.           This will create a file SAMPLE1.TMP which will have a
  5318.           runtime address in front of each source line.
  5319.  
  5320.  
  5321.           WINDOWS
  5322.  
  5323.           Under Windows you must compile using the program WBB.EXE.
  5324.           You may install this in a group with the Program Manager
  5325.           or run WBB seperately.  When compile is completed you may
  5326.           either execute the program or restart to compile another
  5327.           program.
  5328.  
  5329.           IMPORTANT!  Whether you are compiling under DOS or Windows
  5330.           only one EXE file will be created.  This file will have
  5331.           the same name as the source file with an extension of
  5332.           .EXE.  This EXE file can be executed under either DOS or
  5333.           Windows as long as the appropriate runtime module is
  5334.           present (BBLIB14.EXE for DOS or WBBLIB14.EXE for Windows).
  5335.           If you are using graphics screens running under Windows
  5336.           you will also need the file WBB.FON.
  5337.  
  5338.  
  5339.           If you are running Windows 3.1 in 386 Enhanced Mode and
  5340.           using text only screens see the section on Default Windows
  5341.                                       80
  5342.  
  5343.  
  5344.  
  5345.  
  5346.  
  5347.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5348.  
  5349.  
  5350.  
  5351.  
  5352.  
  5353.           Font for important information on using different font
  5354.           sizes.
  5355.  
  5356.           
  5357.  
  5358.  
  5359.  
  5360.  
  5361.  
  5362.  
  5363.  
  5364.  
  5365.  
  5366.  
  5367.  
  5368.  
  5369.  
  5370.  
  5371.  
  5372.  
  5373.  
  5374.  
  5375.  
  5376.  
  5377.  
  5378.  
  5379.  
  5380.  
  5381.  
  5382.  
  5383.  
  5384.  
  5385.  
  5386.  
  5387.  
  5388.  
  5389.  
  5390.  
  5391.  
  5392.  
  5393.  
  5394.  
  5395.  
  5396.  
  5397.  
  5398.  
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.                                       81
  5408.  
  5409.  
  5410.  
  5411.  
  5412.  
  5413.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5414.  
  5415.  
  5416.  
  5417.  
  5418.  
  5419.           
  5420.           DEFAULT WINDOWS FONT
  5421.           -------------------------------------------------------
  5422.           
  5423.           The following discussion is current for Windows Version
  5424.           3.1.  The concepts discussed are applicable for Version
  5425.           3.0, however, font file names are different for that
  5426.           version.  This section is only relevant when running in
  5427.           screen MODE 0 (the default).
  5428.  
  5429.           BasicBasic selects the OEM Fixed font closest in size to
  5430.           the system font size used in menus, buttons, etc.  If you
  5431.           desire a different font size when running a BasicBasic
  5432.           program you can select from available fonts in the System
  5433.           Menu.  You may also mark a given font size to be the new
  5434.           default for that program.
  5435.  
  5436.           Depending on how you configured your system there may be
  5437.           only one OEM font installed.  Windows 3.1 comes with an
  5438.           assortment of OEM fonts.  The file DOSAPP.FON contains the
  5439.           fonts used by Windows to run DOS in a window and are good
  5440.           for use with BasicBasic.  If this file is not in you
  5441.           windows system directory (e.g. WINDOWS\SYSTEM) then your
  5442.           can copy it from your distributions disks and then use the
  5443.           Control Panel Fonts accessory to install them (These fonts
  5444.           have the name 'MS-DOS CP 437').
  5445.  
  5446.           IMPORTANT INFORMATION FOR 386 ENHANCED MODE:  If you use
  5447.           the MS-DOS prompt in 386 Enhanced mode you will need to
  5448.           make a change in your SYSTEM.INI file to use multiple size
  5449.           fonts in BasicBasic.  As mentioned previously Windows does
  5450.           not normally permanently install the fonts from
  5451.           DOSAPP.FON.  As was indicated you can do this from the
  5452.           Control Panel Fonts accessory.  HOWEVER, you will find
  5453.           that each time you EXIT the MS-DOS prompt these fonts will
  5454.           be REMOVED from the system.  This is because Windows does
  5455.           not expect these fonts to be present and there is a
  5456.           control line in SYSTEM.INI which explicitly tells it to
  5457.           load and unload them when running the MS-DOS prompt.  Once
  5458.           you have installed these fonts you can keep Windows from
  5459.           un-installing them by removing the following line from the
  5460.           [386Enh] section of SYSTEM.INI:
  5461.  
  5462.                    WOAFONT=DOSAPP.FON
  5463.  
  5464.  
  5465.           FONTS AND BUTTONS: This discussion applies only to buttons
  5466.           which are defined by the user to be one line high.  If you
  5467.           select a font smaller than the system font for use in a
  5468.           BasicBasic program the text in any buttons you have would
  5469.           be too crowded in the button space available.   BasicBasic
  5470.           corrects this problem in one of two ways.  1) If you
  5471.           system font is only slightly larger than the font selected
  5472.           in BasicBasic then any text in the buttons will be made
  5473.                                       82
  5474.  
  5475.  
  5476.  
  5477.  
  5478.  
  5479.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5480.  
  5481.  
  5482.  
  5483.  
  5484.  
  5485.           all upper case so no 'descenders' will be outside the
  5486.           button area.  2) If the system font is quite a bit larger
  5487.           than the selected font then BasicBasic will not use the
  5488.           standard Windows button design.  Instead it will draw a
  5489.           'simplified' button which can hold the small text of the
  5490.           font.
  5491.           
  5492.  
  5493.  
  5494.  
  5495.  
  5496.  
  5497.  
  5498.  
  5499.  
  5500.  
  5501.  
  5502.  
  5503.  
  5504.  
  5505.  
  5506.  
  5507.  
  5508.  
  5509.  
  5510.  
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.  
  5520.  
  5521.  
  5522.  
  5523.  
  5524.  
  5525.  
  5526.  
  5527.  
  5528.  
  5529.  
  5530.  
  5531.  
  5532.  
  5533.  
  5534.  
  5535.  
  5536.  
  5537.  
  5538.  
  5539.                                       83
  5540.  
  5541.  
  5542.  
  5543.  
  5544.  
  5545.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5546.  
  5547.  
  5548.  
  5549.  
  5550.  
  5551.  
  5552.           ERROR MESSAGES
  5553.           -------------------------------------------------------
  5554.  
  5555.           Compile errors will give a description of the problem and
  5556.           display the line where the error occurred.
  5557.  
  5558.           Runtime errors are divided into two classes.  Fatal errors
  5559.           always cause execution of the program to cease.
  5560.           Recoverable errors cause program execution to cease if
  5561.           SETERRLEVEL is 7, overwise execution continues and the
  5562.           error number is placed in the system variable ERR.
  5563.           SETERRLEVEL 7 is the default.
  5564.  
  5565.           When runtime errors are displayed they are accompanied by
  5566.           a runtime address.  BasicBasic will output a list of
  5567.           runtime addresses for each statement.  These addresses
  5568.           will be contained in a file with the same name as the
  5569.           source file and an extension of .TMP.
  5570.  
  5571.           Fatal Errors:
  5572.  
  5573.                error number              description
  5574.                ------------              -----------
  5575.  
  5576.                   236         Out of memory
  5577.                   503         READ is attempting to read wrong kind
  5578.                               of data.
  5579.                   501
  5580.                   ...
  5581.                   522         Internal runtime errors.
  5582.                   523         Wrong number of array elements or
  5583.                               array not dimensioned.
  5584.                   524         Out of free space.
  5585.                   525         Out of string space.
  5586.                   526         Return without gosub
  5587.                   527         Not enough memory for menu
  5588.                   528         SUB without CALL
  5589.                   529         END SUB without CALL
  5590.                   530         Out of space for functions
  5591.                   531         SUB/CALL have different # of parms
  5592.  
  5593.  
  5594.           Recoverable Errors:
  5595.  
  5596.                   1000        Error attempting to open file
  5597.                   1001        Attempt to read past end of file
  5598.                   1002        File not open
  5599.                   1003        File read error (probably hardware)
  5600.                   1004        ASC function on empty string
  5601.                   1005        Divide by zero
  5602.                   1006        Out of data during READ
  5603.                   1007        File already open
  5604.                   1008        No available file control block
  5605.                                       84
  5606.  
  5607.  
  5608.  
  5609.  
  5610.  
  5611.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5612.  
  5613.  
  5614.  
  5615.  
  5616.  
  5617.                   1009        Error attempting to open file
  5618.                   1010        File mode error on read
  5619.                   1011        File mode error on write
  5620.                   1012        Bad file number
  5621.                   1013        Path not found
  5622.                   1014        RMDIR error
  5623.                   1015        MKDIR error
  5624.                   1016        KILL error
  5625.                   1017        FILE BUFFER ERROR
  5626.                   1018        INVALID FIELD DATA
  5627.                   1019        FIELD OVERFLOW
  5628.                   1020        FILE ERROR
  5629.                   1021        COMMUNICATIONS OPEN ERROR
  5630.                   1022        CREATE BUTTON ERROR
  5631.                   1023        BAD SCREEN MODE IN SCREEN COMMAND
  5632.                   1025        GRAPHICS GET ARRAY ERROR
  5633.                   1026        GRAPHICS PUT ARRAY ERROR
  5634.                   1027        CREATE FONT ERROR
  5635.                   1028        NOT IN CORRECT SCREEN MODE
  5636.                   1029        INVALID COLOR/COLOR ATTRIBUTE
  5637.                   1030        ILLEGAL FONT NUMBER
  5638.                   1031        FONT NOT DEFINE
  5639.                   1032        PALETTE NOT DEFINED
  5640.                   1033        BITMAP COMPRESS ERROR
  5641.                   1034        NOT ENOUGH MEMORY TO LOAD BITMAP
  5642.                   1035        UNKNOWN ERROR READING BITMAP
  5643.                   1036        UNKNOWN BITMAP TYPE
  5644.                   1037        ERROR STORING BITMAP FILE
  5645.                   1038        BITMAPH FAILURE
  5646.                   1039        NOT A BITMAP FILE
  5647.                   1040        CREATEBITMAP-NOT ENOUGH MEMORY
  5648.                   1041        SELECTBITMAP ERROR
  5649.                   1042        COPYBITS ERROR
  5650.                   1043        INVALID CONTROL IN DIALOG
  5651.                   1044        NOT ENOUGH MEMORY FOR DIALOG
  5652.                   1045        CHDIR ERROR
  5653.                   1046        CHDRIVE ERROR
  5654.                   1047        CREATEBITMAP DATA INVALID
  5655.                   1048        STRING TOO SHORT
  5656.  
  5657.  
  5658.  
  5659.  
  5660.  
  5661.  
  5662.  
  5663.  
  5664.  
  5665.  
  5666.  
  5667.  
  5668.  
  5669.  
  5670.  
  5671.                                       85
  5672.  
  5673.  
  5674.  
  5675.  
  5676.  
  5677.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5678.  
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.           KEYBOARD CODES
  5685.           -------------------------------------------------------
  5686.  
  5687.           The following table shows the key codes returned by the
  5688.           INKEY$ function.  These key codes are returned as 1 byte.
  5689.  
  5690.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  5691.                  KEY CODE        KEY CODE        KEY CODE
  5692.             ESC    27                       BKSP    8
  5693.             1      49        !     33       TAB     9
  5694.             2      50        @     64       ENTER   13
  5695.             3      51        #     35       SPACE   32
  5696.             4      52        $     36
  5697.             5      53        %     37
  5698.             6      54        ^     94
  5699.             7      55        &     38
  5700.             8      56        *     42
  5701.             9      57        (     40
  5702.             0      48        )     41
  5703.             -      45        _     95
  5704.             =      61        +     43
  5705.  
  5706.             KEY  DECIMAL    KEY  DECIMAL    KEY  DECIMAL
  5707.                  KEY CODE        KEY CODE        KEY CODE
  5708.              A     65        a     97
  5709.              B     66        b     98
  5710.              C     67        c     99
  5711.              D     68        d     100
  5712.              E     69        e     101
  5713.              F     70        f     102
  5714.              G     71        g     103
  5715.              H     72        h     104
  5716.              I     73        i     105
  5717.              J     74        j     106
  5718.              K     75        k     107
  5719.              L     76        l     108
  5720.              M     77        m     109
  5721.              N     78        n     110
  5722.              O     79        o     111
  5723.              P     80        p     112
  5724.              Q     81        q     113
  5725.              R     82        r     114
  5726.              S     83        s     115
  5727.              T     84        t     116
  5728.              U     85        u     117
  5729.              V     86        v     118
  5730.              W     87        w     119
  5731.              X     88        x     120
  5732.              Y     89       y      121
  5733.              Z     90       z      122
  5734.  
  5735.  
  5736.  
  5737.                                       86
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5744.  
  5745.  
  5746.  
  5747.  
  5748.  
  5749.           The following table shows the extended key codes returned
  5750.           by the INKEY$ function.  These key codes are returned as 2
  5751.           characters.  In this case the first character will be 0.
  5752.           
  5753.                     KEY   DECIMAL
  5754.                           KEY CODE
  5755.                     ----  ------
  5756.                      F1    0 59
  5757.                      F2    0 60
  5758.                      F3    0 61
  5759.                      F4    0 62
  5760.                      F5    0 63
  5761.                      F6    0 64
  5762.                      F7    0 65
  5763.                      F8    0 66
  5764.                      F9    0 67
  5765.                      F10   0 68
  5766.  
  5767.                      CTRL-F1   0   94
  5768.                      CTRL-F2   0   95
  5769.                      CTRL-F3   0   96
  5770.                      CTRL-F4   0   97
  5771.                      CTRL-F5   0   98
  5772.                      CTRL-F6   0   99
  5773.                      CTRL-F7   0  100
  5774.                      CTRL-F8   0  101
  5775.                      CTRL-F9   0  102
  5776.                      CTRL-F10  0  103
  5777.                      SHIFT-F1  0   84
  5778.                      SHIFT-F2  0   85
  5779.                      SHIFT-F3  0   86
  5780.                      SHIFT-F4  0   87
  5781.                      SHIFT-F5  0   88
  5782.                      SHIFT-F6  0   89
  5783.                      SHIFT-F7  0   90
  5784.                      SHIFT-F8  0   91
  5785.                      SHIFT-F9  0   92
  5786.                      SHIFT-F10  0  93
  5787.                      HOME       0  71
  5788.                      UP ARROW   0  72
  5789.                      PGUP       0  73
  5790.                      LEFT ARROW 0  75
  5791.                      RIGHT ARR  0  77
  5792.                      END        0  79
  5793.                      DOWN ARROW 0  80
  5794.                      PGDN       0  81
  5795.                      INS        0  82
  5796.                      DEL        0  83
  5797.                      CTRL-HOME  0  119
  5798.                      CTRL-PGUP  0  132
  5799.                      CTRL-LEFT  0  115
  5800.                      CTRL-RIGHT 0  116
  5801.                      CTRL-END   0  117
  5802.                      CTRL-PGDN  0  118
  5803.                                       87
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.                   Copyright (c) 1992, 1993 by Mark Davidsaver
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.           Windows is a registered trademark of Microsoft
  5818.           Corporation.
  5819.  
  5820.  
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.  
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846.  
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.  
  5856.  
  5857.  
  5858.  
  5859.  
  5860.  
  5861.  
  5862.  
  5863.  
  5864.  
  5865.  
  5866.  
  5867.  
  5868.  
  5869.                                       88
  5870.  
  5871.  
  5872.  
  5873.  
  5874.  
  5875.